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

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 asp.net 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.


webQAsked:
Who is Participating?
 
riyasjefCommented:
Put

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

RJ

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

you also have to uncheck the "Anonymous Access" in IIS:
http://www.expresscomputeronline.com/20030721/techspace2.shtml
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.