Access to path is denied. Permissions problem with FileUpload control in user control.

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
10/31/2011 12:53:17 PM
Gravatar
Total Posts 21

Access to path is denied. Permissions problem with FileUpload control in user control.

I am receiving a "Access to path is denied message" in regard to the path I am trying to allow users to upload files to. I have set NetworkService to have both Modify and Write privileges on the userfiles directory. In IIS 7, the website is using DefaultAppPool whose identity is NetworkService and it is targeting .NET 4.0 framework. At this point I have even tried using Everyone with all permissions and still I receive the error. Any tips?

Code for control:

if (FileUploader.HasFile)
        {
            try
            {
                string filename = System.IO.Path.GetFileName(FileUploader.FileName);
                FileUploader.SaveAs(Server.MapPath("//Data/Sites/1/userfiles"));               
            }
            catch (Exception ex)
            {
                label_UploadStatus.Text = "Upload status: The file could not be uploaded. <br />The following error occurred: " + ex.Message;
            }
        }

 

10/31/2011 1:00:01 PM
Gravatar
Total Posts 21

Re: Access to path is denied. Permissions problem with FileUpload control in user control.

UPDATE

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am very sorry for posting this needlessly because I have already discovered my error. The path in the control needs to specify a file name for the uploaded document.

You must sign in to post in the forums. This thread is closed to new posts.