System.Net.WebPermission error with Full-Trust

Topics: Developer Forum
Mar 14, 2011 at 4:43 PM

Hi,

I'm experiencing a weird problem:

a "'System.Net.WebPermission" appears with this code:

        Dim f As Flickr = New Flickr(OAuthTok.Flickr_Key)
  >>>      Dim gals As PhotosetCollection = f.PhotosetsGetList("60562694@N05")

When fetching PhotoSets.

Environment:

1) Win7
2) Calling rest URL (http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=XXX&user_id=60562694@N05) gives no error
3) Website is in FullTrust, dev machine
4) I had a previuos problem with cache. It was solved with web.config disableCache.

[SecurityException: Error de solicitud de permiso de tipo 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +54
System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint) +204
System.Net.HttpRequestCreator.Create(Uri Uri) +38
System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase) +256
FlickrNet.Flickr.DoGetResponse(Uri url) +164
FlickrNet.Flickr.GetResponse(Dictionary`2 parameters, TimeSpan cacheTimeout) +271
FlickrNet.Flickr.GetResponseCache(Dictionary`2 parameters) +83
FlickrNet.Flickr.PhotosetsGetList(String userId) +136

This code gives no errors:
        Dim req As HttpWebRequest
        req = HttpWebRequest.Create("http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=XXXX&user_id=60562694@N05")
        req.GetResponse()

Thanks!
SntsDev

Coordinator
Mar 15, 2011 at 9:20 PM

This is very strange, as all my code does it pretty much what you have written there.

Could you try setting Method to "POST", Timeout to 100000 and KeepAlive to false to truly emulate my code?

Sam