Results 1 to 4 of 4

Thread: [RESOLVED] System.UnauthorizedAccessException

  1. #1

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Resolved [RESOLVED] System.UnauthorizedAccessException

    Ok, here's the thing, i have an ASP.NET page that sometimes needs to read other files, images and text files, worked fine on my development pc.. but now i have moved it over to windows server 2003, i get this security error

    Exception Details: System.UnauthorizedAccessException: Access to the path "D:\Inetpub\wwwroot\useragree.txt" is denied.

    but ASPNET and NETWORK SERVICE and the IUSR account all have read permission to the folder, and that's all i need to do, is read.. not write. This could also be part of my debugging issue im having though (the old, unable to debug, access denied) error, all the old threads i looked up didnt solve my particular problem.

    EDIT NOTE: I just tried setting "Everyone" to read access.. still doesnt work, this has to be a .NET problem then right?

    Any Ideas?
    Last edited by Phill64; Feb 25th, 2006 at 12:25 AM.

  2. #2
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: System.UnauthorizedAccessException

    look in the event logs to see what user account it is using.
    Also make sure that the integrated Windows Authentication check box is ticked in the IIS website properties.

    it's not a .NET issue - its the security in which Windows is denying as it has no access right to give

  3. #3

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: System.UnauthorizedAccessException

    which log files? where would they be?
    there is no mention of it in the IIS logs. Windows Auth is ticked.

  4. #4

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: System.UnauthorizedAccessException

    Figured it out, found out user account using security namespace.. and it wasNETWORK SERVICE which had permission.. thing was, when opening a filestream, even though u open a file in "open" mode, if u dont use the next overload where accessmode is specified, it still opens it in read&write mode, so i used the overload to make it readonly, now it works!

    thanks for the replies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width