Link to home
Start Free TrialLog in
Avatar of Tech_View
Tech_View

asked on

Access to network path denied

I have a shared folder : \\10.10.0.12\PDF Archive\KCAI
I use this code to access it:
        Dim strdir = "\\10.10.0.12\PDF Archive\Khorasan"
        Dim DirInfo As New IO.DirectoryInfo(strdir)
        Dim subDirs As IO.DirectoryInfo() = DirInfo.GetDirectories()
        Dim Files As IO.FileInfo() = DirInfo.GetFiles()

After the code runs, It asks 3 times for user name and password, and does not accpet any, and then I get this error :
Access to the path '\\10.10.0.12\PDF Archive\KCAI denied.

* In web config:
    <authentication mode="Windows"/>
    <identity impersonate="true"/>

* I have a domain.
* I set the ASP.NET permission to that folder.

Please Help.
Thank you.

Avatar of raterus
raterus
Flag of United States of America image

Do you want the user who is using your application to be the one to hit this file share, with his/her credentials? (harder setup)  Or could you use a shared set of credentials? (easier)
Avatar of thuannguy
thuannguy

If your server uses Windows 2003, could you give the NETWORK SERVICE account permission to that folder and try again?
Negative thuannguy, the only permission you can add on a file share in this case is "Everyone".  You need a domain account to get this one to work with specific credentials.
You can add the network service if the web server is running on the same machine as the share.

You can set the anonymous login account as a domain user but everyone will login with the same account.

In Active Directory you can set the "trust computer for delegation" on the computer account and use windows authentication in web site properties. This will pass the credentials of the use that logs in.
Avatar of Tech_View

ASKER

* raterus:
I need credentials for each user. I have over 300 users in my domain.

* thuannguy:
The web server machine is differ from shraed folder machine, so I can not do that.

* MCKreed:
1. The web server is not the same with shared one.
2. I don't want to use anonymous logon.
3. Currently I use windows authentication on web server. About trust for delegation, must trust wich computer? Shared or the web server? and wich service?
In active directory if you go to the computer with the web server on it, right click and go to properties.

On the general screen you will see "Trust computer for delegation". Placing a check mark in this screen allows the computer to pass network credentials back and for from the client to active directory.
MCKreed:
I went to active directory users and computers.
I did right click on web server computer name.
I clicked on properties.
In general Tab, there is no item "Trust computer for delegation". But I have another tab, named: delegation.
What OS is Active directory working on?
* thuannguy:
The web server machine is differ from shraed folder machine, so I can not do that.
Yeah, not really "cannot"! However, at my company, we create a domain user account, give it permission to the share folder and run the application under that account:

 <identity impersonate="false" userName="..." password="..." />
But you mentioned NETWORK SERVICE account , thuannguy.

How could you assign a local account in another machine?
The OS is W2K3 Enterprise Edition SP2, MCKreed.
I mentioned NETWORK SERVICE account in the first answer because you didn't specify any domain account in the impersonate setting.

*How could you assign a local account in another machine?: not a local account, it is a DOMAIN user account.
Please note that I made a mistake on my second post :(. Impersonate must be 'true'

 <identity impersonate="true" userName="aDomainUserAccount" password="abcxyz" />
http://support.microsoft.com/kb/326089

here is an article from Microsoft. It explains the process.

I'm not sure why you have a delegation tab. You may have an add on installed that extends AD users and computers.
Thank you thuannguy :). But currently I have impersonate with true value.
And, you mean that we have NETWORK SERVICE as a domain account?
Thank you MCKreed. I marked the "Trust this computer for delegation to any service (Kerberos only)" in Delegation tab, for both the web server, and shared folder machine. But still no improvement.
Yes, 'true' is correct. I said it again because in my second answer, I give you a wrong example whose impersonate value is 'false'.
Regarding your question about domain user account: this is a quote from my second answer:
"However, at my company, we create a domain user account, give it permission to the share folder and run the application under that account:"

And the identity tag will be:
 <identity impersonate="true" userName="aDomainUserAccount" password="abcxyz" />
Restart the web-server if you can.  None of my delegation settings in the past took effect until I did this.  Also, are you using a fully-qualified domain name on your webserver, e.g "intranet.mydomain.com", you'll need to configure some SPN's if that is the case.  Don't stick any credentials in the impersonate tag, they are not needed for what you want.
raterus,
I restarted the server, but nothing happened.
How about the second part of my comment?  What does the URL for this website look like?
raterus,
For the webpage, I use fully qualified domain name on my webserver. for example: http://ln.x.y.net .
ASKER CERTIFIED SOLUTION
Avatar of raterus
raterus
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have to read about setspn carefully. I am not familiar with it. I will try and will have a feedback here ....
Forced accept.

Computer101
EE Admin