Reputation: 25308
public class UploadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
...
// Create the directory if needed...
if (!Directory.Exists(uploadDir))
{
System.Security.AccessControl.DirectorySecurity ds = new System.Security.AccessControl.DirectorySecurity(RivWorks.AppSettings.UploadRoot, System.Security.AccessControl.AccessControlSections.All);
Directory.CreateDirectory(uploadDir, ds);
}
...
}
I have the above snippet of code for a ASHX file and it works fine in my local environment. As soon as I push it to a server environment I don't get an error, it appears to have built the directory, yet when I check for it - well - it is not there. When I run it via a FLEX app we are getting this error:
Error #2038: File I/O Error. URL: http://[ourdomain].com/UploadHandler.ashx?CompanyID=d229cc80-ca96-4a8a-992c-80c94ac2c6b4
Is there anything I am missing?
UPDATE:
I get this error now when trying to create a directory:
The process does not possess the 'SeSecurityPrivilege' privilege which is required for this operation.
Upvotes: 0
Views: 1899
Reputation: 137128
Have you checked that your program has the correct access rights to the relevant directories on the server?
If you don't have the right permissions either because the account you are using is restricted or the directories are locked down you will see this error.
Upvotes: 2
Reputation: 1
Just simple use mkdir() function to create directory. to define a path you may use SERVERMAPPATH attribute.
use within try catch endtry block to avoid already existing or any other Error.
Upvotes: 0
Reputation:
Is the site runs with identity impersonation=true? If so it runs under your credentials/authorization in your environment
Upvotes: 0