We help IT Professionals succeed at work.

ASP.Net, Access to the path is denied from remote, works from local

1,372 Views
Last Modified: 2012-06-21
I am trying to find out why an ASP.net program works when accessed from the same machine that has the web server, but fails when accessed from another machine in the local network.

I have an ASP.net program that puts a list of files into a list box. The files are in a network directory that resides on a 3rd machine, accessed via \\mach3\myDir\... I logon into machine A (where the web browser resides) and bring up the web page. All of the files are in the list box. I logon to machine B and bring up the web page, I get an error (see above). What is IIS doing differently to tasks that originate from the local machine and tasks that originate from another machine? Some other info:

- The security type is integrated windows, no annomyous user
- On both machines, the Environment.UserName returns the same value  (myUser)
- On both machines the HttpContext.Current.User.Identity.Name returns the same value
  (MyDomain\myUser)
- Both machines are Windows 2003 SBS
- Before refering to the fixe as a UNC name (\\mach3\myDir...), I referred to the dir using a mapped drive (X:\myDir\...). I worked on the local drive and didnt on the remote drive. The error was "Path xxx not found".  (Maybe local and remote tun under a different process?)

- My test machine is XP/Pro, VS 2008, allow annonomous. It is on a different Domain. Environment.UserName returns ASPNET and HttpContext.Current.User.Identity.Name returns MyDomain\myUser

I know that the CustomErrors field in web.config can make the server work differently when the client is not on the local machine. Are there other differences that must be set up or considered?

Thank you.
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
OK,  Thanks. A couple of questions:
1) How do I find the machine account if the IIS (6.0) server. Do I look at the identity tab on the application pool (which is Network Service), or somewhere else (web.config or machine.config), or is it hard-coded to Network Service?

2) I think I would rather do user authentication. When you say impersonation, do you mean put the following into a web.config's <system.web? section:
    <identity impersonate="true" />

3) in Option 1, can I just use Network Services?

4) In Option 2, is Windows Authorization (specified from the directory security tab) considered Kerberos?

5) In Option 2, what in our example is the destination server? Is it the one with the data that the web server is trying to access, the web server machine, or is it the web client's machine?

Thank you.
PS, to get something running, I am trying option 1, but first I need our network admin to get me connected.

Author

Commented:
I tried option 1. I granted everyone I could think of full authority to the network dir. Still doesnt work.
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I made a mistake. I assumed if you dont have an impersonate statement in your app's web.config, it will be off. On my customer's machine, someone put a web.config file in the root dir that has an impersonate true statement. When I realized this I set impersonate to false and walla, it worked. Why Network Service can access the Remote Share and my ID cannot, I do not know, but this works fine.

Thank you for your help. Sorry for the mistake.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.