locked
Error Uploading photos RRS feed

  • Question

  • User-557590556 posted

    Hi.  I'm getting this error when trying to upload a photo from my system to the website which is live.  I tried following the instruction in the error message to grant permission to ASP.NET by changeing file permissions in the security tab of explorer.  The file already seems to have full access (every possibility is checked for SYSTEM, myself and Admin).  I don't see anywhere to highlite ASP.NET or any users to add.  Help please.  I looked at upload and App_Code\BLL\Photos.vb.  Maybe I'm looking at the wrong file?  Thanks.

    Access to the path 'd:\hosting\rporterpg\Upload\2.Lg.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.UnauthorizedAccessException: Access to the path 'd:\hosting\rporterpg\Upload\2.Lg.jpg' 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 258:		Private Shared Sub WriteToFile(ByVal filename As String, ByVal bytes() As Byte)
    Line 259:			If Not (filename Is Nothing) Then
    Line 260:				Dim full As FileStream = File.Open(filename, FileMode.Create)
    Line 261:				Try
    Line 262:					full.Write(bytes, 0, bytes.Length)

    Source File: d:\hosting\rporterpg\App_Code\BLL\Photos.vb    Line: 260

    Friday, April 4, 2008 9:54 PM

Answers

  • User1128022426 posted

    You need to setup the the asp.net user (I think its the IIS authentication user)....

    I believe the default is IUSR_<MachineName>. make sure that is the user that has write access to that folder

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 5, 2008 12:15 AM

All replies

  • User1128022426 posted

    You need to setup the the asp.net user (I think its the IIS authentication user)....

    I believe the default is IUSR_<MachineName>. make sure that is the user that has write access to that folder

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 5, 2008 12:15 AM
  • User-557590556 posted

    Thanks for the suggestion.  I've found a previous error and fixed it and now the photos work.  Thanks again.

    Saturday, April 5, 2008 1:32 AM