i'm using vs.net 2003.... i want to let the user upload images and i want to save the image to my web server file to convenient i display the images on other pages.... but i'm having a problem when i try to save the images file to my we b server side....
here is my code :
error:
Access to the path 'C:\Domains\bli ssfulbridalstud io.com\httpdocs \Img\Sunset.jpg ' 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.Unauthor izedAccessExcep tion: Access to the path 'C:\Domains\web page.com\httpdo cs\Img\Sunset.j pg' 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}\ASPNE T 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="tr ue"/>, the identity will be the anonymous user (typically IUSR_MACHINENAM E) 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.
thanks!!!
here is my code :
Code:
Dim CurrentFileName As String
CurrentFileName = FileUpload1.FileName
Dim CurrentPath As String = Server.MapPath("~/Img/")
If FileUpload1.HasFile Then
CurrentPath += CurrentFileName
FileUpload1.SaveAs(CurrentPath)
Response.Write("Upload the file already !!!")
Else
Response.Write("Can not load the file !")
End If
Access to the path 'C:\Domains\bli ssfulbridalstud io.com\httpdocs \Img\Sunset.jpg ' 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.Unauthor izedAccessExcep tion: Access to the path 'C:\Domains\web page.com\httpdo cs\Img\Sunset.j pg' 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}\ASPNE T 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="tr ue"/>, the identity will be the anonymous user (typically IUSR_MACHINENAM E) 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.
thanks!!!
Comment