FlickrNet.dll Security Exception

Topics: User Forum
Mar 24, 2008 at 1:25 AM
Hello,

I've created a custom Flickr gallery using the FlickrNet.dll. This all works and compiles locally but when I deploy to my web server I receive the following security error:

The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

From what I can glean the internet I think this has something to do with the FlickrNet.dll not being signed - a strong name not being assigned - but i'm not sure.

Can you help?

Thanks.
Mar 24, 2008 at 1:57 AM
Scarp that last comment.

This looks like a permission problem with my host (when the cache attempts to write to the server). In the meantime I've disabled the cache and set requirePermission="false" on the flicknet section...just in case this helps anybody else.

Thanks....
Coordinator
Mar 25, 2008 at 11:08 AM
The error is likely due to the fact that you don't have permission to add new sections to the web.config file. If you set the cache location in code, rather than trying to do it in the web.config file then it might work fine.
Mar 31, 2008 at 8:47 PM

Meander365 wrote:
Scarp that last comment.

This looks like a permission problem with my host (when the cache attempts to write to the server). In the meantime I've disabled the cache and set requirePermission="false" on the flicknet section...just in case this helps anybody else.

Thanks....


Meander365, I have the same issue but that setting does not exist in the FlickNet config section

Parser Error Message: Unknown attribute 'requirePermission' in flickrNet node

<configSections>
<section name="flickrNet" type="FlickrNet.FlickrConfigurationManager,FlickrNet"/>
</configSections>
<flickrNet cacheDisabled="true" requirePermission="false">
</flickrNet>

Mar 31, 2008 at 9:06 PM

learnerplates wrote:

Meander365 wrote:
Scarp that last comment.

This looks like a permission problem with my host (when the cache attempts to write to the server). In the meantime I've disabled the cache and set requirePermission="false" on the flicknet section...just in case this helps anybody else.

Thanks....


Meander365, I have the same issue but that setting does not exist in the FlickNet config section

Parser Error Message: Unknown attribute 'requirePermission' in flickrNet node

<configSections>
<section name="flickrNet" type="FlickrNet.FlickrConfigurationManager,FlickrNet"/>
</configSections>
<flickrNet cacheDisabled="true" requirePermission="false">
</flickrNet>




Ok scratch that, I've found the property is in the assembly reference and not the config section i.e.
<section name="flickrNet" type="FlickrNet.FlickrConfigurationManager,FlickrNet", requirePermission="false"/>

But the error still remains for me.
Coordinator
Apr 1, 2008 at 7:39 AM
If you are getting a security exception then you will likely have to remove the <section> and <flickrNet> bits completely from you web.config and just do the equivalent in code instead.
Apr 8, 2008 at 7:44 PM

samjudson wrote:
If you are getting a security exception then you will likely have to remove the <section> and <flickrNet> bits completely from you web.config and just do the equivalent in code instead.


I don't get this at all!!!
How should I apply the same permission programmatically?
Or even better how can I access public photos from my own flickr account without this security requirement?
I don't get the frob thing either. I understand that you are supposed to get the frob from the response gotten from a redirect, I tried getting the from from the page that I re-direct to but I get this SecurityExpection again when I try to use it by calling
string frob = Request.QueryString"frob";
Auth auth = flickr.AuthGetToken(frob);

All calls to the my flickr object fail with the Security exception! point me to a full example please.
Coordinator
Apr 9, 2008 at 1:08 PM
Inside the constructor for the Flickr class there is a call that tries to load the default settings from the configuration file (i.e. web.config).

If you are running in a restricted security environment (such as a hosted web site with an ISP) then you might not be allowed to put new config sections inside a web.config file so when it parses the file a security exception is thrown. It will do this anytime you create an instance of the Flickr class.

If your web.config file contains any of the following items (<section> or <flickrNet> elements):
<configSections>
<section name="flickrNet" type="FlickrNet.FlickrConfigurationManager,FlickrNet"/>
</configSections>
<flickrNet cacheDisabled="true">
</flickrNet>
...

Then you need to remove them:

<configSections>
</configSections>
...

As an aside, the requirePermissions attribute is an attribute of the <section> element, not the <flickrNet> element.