views:

33

answers:

1

Hi all,

My web service needs to open some files located on a remote computer.

From Windows I can do the authentication so I can see those files using the File Explorer.

If I try to open the files from my Web Service while it's running using Visual Studio (ASP.NET Development Server) it also works.

However, if I do everything from IIS it doesn't.

In order to find out where is the problem what I did was to run a network sniffer and I found out that when using IIS, the system will try to use the account 'ASPNET' to login into those remote computers which will obviously fail.

However this doesn't happen if I run from the IDE (Using the ASP.NET Development Server)

I found out that if I use Impersonation for accessing this it will work, the problem is I need to have the same account names on the computer running IIS so I would rather not to do that.

Why is it working from the ASP.NET Development Server and not from IIS? Is there a way to give full access to the ASPNET account?

Thanks and hopefully somebody will be able to help with this. I don't know what else to try...

A: 

Any request on IIS is served by the ASPNET user. So the user ASPNET is working. I think you are using XP. On Win2K3 etc, the user is Network Service

But the Cassini (Visual Studio Dev server) runs under the current logged in user.

So the difference is. You need to use impersonation for your need.

Kangkan
Thanks for your reply. Yes, I'm using Windows XP. So do you mean that if I use Win2K3 it should work without impersonation?
Definitely not. Impersonation is required for both the cases.
Kangkan
@Kangkan: it's not always `ASPNET`. It's whatever account the pool is configured to use.
John Saunders
Kangkan, one last question. Is it possible to use Impersonation without having to create those accounts on the computer where IIS is running? Thanks
Just think of why we need this. Otherwise anybody can get access of the files. If your files are so public, you can host them on an HTTP or FTP server with anonymous access. For getting the access of any file/folder under windows directory, the system requires an account. The account can be a guest account or so. Think of logging in to your system without a user name. Is it possible? So either go for impersonation or host them on a FTP server with anonymous access. You will be happy later.
Kangkan
@John Saunders: You are right. I am referring to the default one.
Kangkan
Thanks Kangkan...I appreciate your help!