Access to the path "\\servername\folder\emp.csv" is denied. (System.UnauthorizedAccessException)

Posted on 2005-05-09
Last Modified: 2008-01-09
I am trying to read a file in the D drive of my server. I could do this with my ASP applications but I am getting this error in my application.I am using streamreader to read the file.

I tried adding servername\ASPNET,servername\IUSR_servername users with read\write permissions to  folderA but no luck. Please help

detailed error -

Access to the path "\\servername\folderA\emp.csv" 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 "\\servername\folderA\emp.csv" 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.

Question by:webQ
    LVL 9

    Accepted Solution


    <identity impersonate="true" /> in web.config


    LVL 4

    Expert Comment

    besides set:
    <identity impersonate="true" />

    you also have to uncheck the "Anonymous Access" in IIS:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video discusses moving either the default database or any database to a new volume.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now