Access to path FlickrNet is denied

Topics: Developer Forum, User Forum
Jan 13, 2011 at 2:10 AM

I am receiving this issue on the website that is live. However, on my local machine everything works fine. This occurs when I am doing a photo search and trying to pull down photos for my Flickr account and certain tags. Based on the stack trace it looks like it blows up during the call

FoundUser user = flick.PeopleFindByUserName(screenName);


I have searched around and it seems like it keeps coming back to a cache issue. I have seen suggestions such as

Flickr.CacheLocation = Server.MapPath("./Cache");

as well as

Flickr.CacheDisabled = true;

However, I am not exactly sure where in my C# application code to put those lines.


Any help you can provide would be greatly appreciated. Below is the stack trace of the error message I receive:

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)    
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj)    
at System.IO.Directory.CreateDirectory(String path)     at FlickrNet.LockFile.Acquire()    
at FlickrNet.PersistentCache.Get(String key, TimeSpan maxAge, Boolean removeIfExpired)    
at FlickrNet.Flickr.GetResponse[T](Dictionary`2 parameters, TimeSpan cacheTimeout)    
at FlickrNet.Flickr.PeopleFindByUserName(String userName)

Jan 13, 2011 at 7:54 AM

In ASP.Net you need to disable the cache on each time you create an instance of the Flickr object basically. You could put this code into a helper method and call it every time you want to create an instance of the Flickr object like so:



public class FlickrHelper
  private string ApiKey = "xyz";
  private string SharedSecret = "abc";
  public static Flickr GetInstance()
    Flickr.CacheDisabled = true;
    return new Flickr(ApiKey, SharedSecret);


Alternatively you can store the whole lot in the web.config file - see this page for more details:


Jan 14, 2011 at 12:40 AM

Setting Flickr.CacheDisabled = true; worked perfectly! Thank you very much.

Jun 23, 2013 at 4:26 AM
Edited Jun 23, 2013 at 4:26 AM
Not sure why Flickr.CacheDisabled doesn't work, but this seems to work for me:
Flickr _flickr = new Flickr("API_KEY","Secret_Key");
_flickr.InstanceCacheDisabled = true;