?
Solved

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

Posted on 2005-05-09
2
Medium Priority
?
710 Views
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 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.


0
Comment
Question by:webQ
2 Comments
 
LVL 9

Accepted Solution

by:
riyasjef earned 150 total points
ID: 13965472
Put

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

RJ

0
 
LVL 4

Expert Comment

by:Koala119
ID: 13967330
besides set:
<identity impersonate="true" />

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

830 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