How to get URL content using C# from silverlight application? -


i used below code content of given url silverlightlight application got error :

"an exception of type 'system.security.securityexception' occurred in system.windows.dll not handled in user code"

i checked elevated trust in silverlight application. nothing changed!

private void startwebrequest(string url) {    httpwebrequest request = (httpwebrequest)webrequest.create(url);    request.begingetresponse(new asynccallback(finishwebrequest),request); }   private void finishwebrequest(iasyncresult result) {    httpwebresponse response = (result.asyncstate httpwebrequest).endgetresponse(result) httpwebresponse; } 

to avoid mentioned error changed finishwebrequest function as:

private void finishwebrequest(iasyncresult result) {       httpwebrequest req = (httpwebrequest)result.asyncstate;       httpwebresponse response = (httpwebresponse)req.endgetresponse(result) ; } 

can says happend?


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -