Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Unable to Access a folder with code.


I am trying to access a VPP folder through Job-Subscription.

This folder do not have EVERYONE access rights defined in FileManagement, and as Job-Scheduler needs Everyone access to explore this folder through code it fails. and gives error as "Dont have sufficient access to this folder".

UnifiedDirectory dir = HostingEnvironment.VirtualPathProvider.GetDirectory(VirtualPath) as UnifiedDirectory;

How will you give BYPASSACCESSCHECK to a Unifieddirectory as the above statement gives error.

Sep 10, 2009 18:31

An alternative solution could be to impersonate a user with sufficient permissions in the scheduled job,



Sep 10, 2009 20:54

Hi Nitin.

You can get the UnifedDirectory by giving bypass access check this way:

UnifiedDirectory dir = EPiServer.Web.Hosting.VirtualPathHandler.Instance.GetDirectory("virtualPath", true) as UnifiedDirectory; 
if(dir != null) 
// Do your stuff

But the best way is probably to impersonate as Johan says. Look at Erik Nordin`s blog for a great example on impersonation in a scheduled job. 

Hope this helps!

Br, Tore

Sep 11, 2009 8:45
Thanks a lot for the replies
Sep 16, 2009 13:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.