Hello,
After searching and following the instructions that I found on a number of locations, I am at a loss.
I have a file upload script (very simple) that is trying to upload to c:\tmpfiles
I set permissions for the ASP.NET user as well as the IUSR_{machinename} to have full access to c:\tmpfiles.
I have c:\tmpfiles set up as a virtual directory called tmpfiles (which is why in the code below you see /tmpfiles.
But, I still get the error:
Help???
After searching and following the instructions that I found on a number of locations, I am at a loss.
I have a file upload script (very simple) that is trying to upload to c:\tmpfiles
I set permissions for the ASP.NET user as well as the IUSR_{machinename} to have full access to c:\tmpfiles.
I have c:\tmpfiles set up as a virtual directory called tmpfiles (which is why in the code below you see /tmpfiles.
But, I still get the error:
Code:
Server Error in '/' Application.
Access to the path 'C:\tmpfiles' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\tmpfiles' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 8: Dim i As Integer = InStr(1, StrReverse(strFilePath), "\")
Line 9: Dim strFileName As String = Mid(strFilePath, (Len(strFilePath) - i) + 2)
Line 10: strFile.PostedFile.SaveAs("/tmpfiles" & strFileName)
Line 11: fileUploading.visible = false
Line 12: msg.text = "File Uploaded ..."
Source File: C:\Inetpub\[URL unfurl="true"]wwwroot\file_upload.aspx[/URL] Line: 10
Stack Trace:
[UnauthorizedAccessException: Access to the path 'C:\tmpfiles' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2014099
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +998
System.IO.FileStream..ctor(String path, FileMode mode) +65
System.Web.HttpPostedFile.SaveAs(String filename) +87
ASP.file_upload_aspx.Page_Load(Object Source, EventArgs E) in C:\Inetpub\[URL unfurl="true"]wwwroot\file_upload.aspx:10[/URL]
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Help???