Quantcast
Channel: AX Developer Forum
Viewing all articles
Browse latest Browse all 9880

Creating webrequest

$
0
0

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='http://api.cba.am/ExchangeRatesToCSV.ashx?DateFrom=2013-01-01&DateTo=2013-01-10&ISOCodes=USD';
    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();


Viewing all articles
Browse latest Browse all 9880

Trending Articles