FileStream errors attempting to open file on Shared Drive

J

JeffW

Researched this, but none of the proposed solutions are working for me.
Am hoping for some insight.

Am trying to open a binary file that exists on a shared drive for
reading. Code lives inside a .NET web app and looks like this:

FileStream fs = new FileStream(_documentInfo.DocFile, FileMode.Open,
FileAccess.Read);

This statement generates error:

Could not find a part of the path "T:\TN001068\TN001068_Jun2005.PDF"

Details: System.IO.DirectoryNotFoundException

Based on my research, I understand it's a permissions problem. Since
this is a .NET app, the shared drive must be set up to allow access by
the ASP.NET "user". I access the shared drive's properties and under
security, add "ASPNET" user with permission to read and list folder
contents. Same error.

Other research showed me how to use WindowsIdentity.GetCurrent() inside
the app to see what user is in effect when running the app. It tells
me "NT_AUTHORITY/NETWORK SERVICE". I go the shared drive's properties
and set the same permissions for user "NETWORK SERVICE". Same error.

Is there something in IIS that needs to be set?

Any assistance would be eternally appreciated.

Jeff
 
B

Bruce Barker

the network service account is a local account, and thus does not have
network permissions. you will have to impersonate a domain account.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top