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 error concerning webrequest.GetResponse(). It does not return any value, and I can’t understand why it works with run on property “client” and not with ‘server’ ?

here is the code

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

url='api.cba.am/ExchangeRatesToCSV.ashx
permissionSet = new Set(Types::Class);
permissionset.add(new InteropPermission(InteropKind::DllInterop));
permissionset.add(new InteropPermission(InteropKind::ClrInterop));
CodeAccessPermission::assertMultiple(permissionset);
textBuffer = new TextBuffer();
webrequest = System.Net.WebRequest::Create(url);
httpresponse = webrequest.GetResponse();

Hi,

I’m using AX 2009 and I have exactly the same problem, I can’t run some fonctions on server, I wanted to upload csv files on FTP repository. I have tried the same code as yours but without any results, OK on client but error on server. I found a workaround, I use Powershell script ran by windows task scheduler. Some say it’s an AX bug, other say that’s a security restriction. Let me know if you succed in solving this problem

regards,

Thomas