Server.MapPath Access question

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

I have a folder in my NAS and the folder in the C#.Net 2.0 is as
\\\\MyNAS\\MyFolder.
However when I use the Directory.GetFiles(" \\\\MyNAS\\MyFolder"), it gave
me an
System.UnauthorizedAccessException.
I have added the Network Service in the \\\\MyNAS\\MyFolder permission and
security, but it seems not working yet.
Thanks for help.


Jason
 
Jason Huang said:
I have a folder in my NAS and the folder in the C#.Net 2.0 is as
\\\\MyNAS\\MyFolder.
However when I use the Directory.GetFiles(" \\\\MyNAS\\MyFolder"), it gave
me an
System.UnauthorizedAccessException.

This is more of a Systems Management question than a C# question. When you
do a Directory.GetFiles in C#, ultimately the call will be handled by the
operating system and will be limited by whatever permissions the operating
system is giving to the identity that is executing the code.
I have added the Network Service in the \\\\MyNAS\\MyFolder permission
and security, but it seems not working yet.

The "Network Service" local user in the MyNAS machine is going to be a
different user from the "Nework Service" local user in the machine that is
running your application. You should run the web application under the
identity of a user that is known to both machines, and give permissions to
that user in the MyNas folder. One way to do this is to add an <identity
impersonate..../> tag in your web.config, specifying the credentials for the
user.
 

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

Back
Top