Creating Webrequest

I download csv files by given url with class which runs from menuitem. When I set “run on” property of my class “client” everything works, but when I change it to “server” I get deadlock concerning webrequest.GetResponse(). Where is the problem ?

here is code

System.Net.WebRequest webrequest=null;
System.Net.HttpWebResponse httpresponse=null;
System.IO.Stream stream;
System.IO.StreamReader streamReader;
FileIOPermission permission;
Set permissionSet;

permissionSet = new Set(Types::Class);
permissionset.add(new InteropPermission(InteropKind::DllInterop));
permissionset.add(new InteropPermission(InteropKind::ClrInterop));
textBuffer = new TextBuffer();
webrequest = System.Net.WebRequest::Create(url);
httpresponse = webrequest.GetResponse();