I'm just trying out the dotnetwikibot dll in a vb.net web project using vs2010 and I keep getting "Access to the path 'Cache' is denied" on line1 in page_load:
Dim enWiki As New DotNetWikiBot.Site("http://en.wikipedia.org", "user", "pass")
I'm running on local machine. I have tried to create cache directory in project home and in dll home to no avail.
System.UnauthorizedAccessException was unhandled by user code
Message=Access to the path 'Cache' is denied.
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 DotNetWikiBot.Site..ctor(String site, String userName, String userPass, String userDomain)
at DotNetWikiBot.Site..ctor(String site, String userName, String userPass)
at BilVardet.TestWiki.Page_Load(Object sender, EventArgs e) in C:\Users\Max\Documents\My Dropbox\Visual Studio Projects\Projects\BilVardet\BilVardet\TestWiki.aspx.vb:line 11
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Also tried uploading to server (win2008/iis7) with same result. I'm using net 4. any ideas?
There is a special tool to analyze problems with assembly permissions (http://msdn.microsoft.com/en-us/library/tx1dts55.aspx). Try it. Probably some permission is missing at assembly level, particularly file system IO permission.
Here is the list of permissions that I've been using for testing in different environments:
If that doesn't help, I would advise to check permissions for "Cache" subdirectory of your DotNetWikiBot directory. There must be "Security" tab in the properties of that folder. Try experimenting with the permissions, try adding full permissions for everyone and particularly for services. If that subdirectory does not exist, try creating it manually and then experimenting with the permissions.
Please, let me know if it helps.
2+ years old…but thought I'd add something I found. I created a program which used DotNetWikiBot. I set it up to be a single application instance and started it via one of the multimedia hotkeys on my keyboard, configured via the Microsoft Mouse and Keyboard center.
I was getting the same issue about the access to path cache is denied. What I found is that it was trying to create the cache directory in c:\windows\syswow64, which as a mere end user I did not have access to. If I started the program directly from explorer in it's "home" then all worked well.
Looking at the source, the code just tries to open "cache\….." assuming that whatever the current directory is should be where that cache should be. I haven't done this yet, but my solution will be to to prepend something like %APPDATA% or %TEMP% to that location so that the cache storage is relative to the user account and not where the program runs from.
That's a good idea!
Thanks Anonyous helper! Solved my problem.
In my case I just changed the code to force it to always create the cache folder in the same place that i had write access to.
// Find path to index.php
stringng cacheFile = serverPath + "/Cache" + Path.DirectorySeparatorChar +
HttpUtility.UrlEncode(address.Replace("://", ".").Replace("/", ".")) + ".xml";
Directory.CreateDirectory(serverPath + "/Cache");
With serverpath being the root directory of my website.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.