Can't get ASP.Net to access remote folder share

G

Garrek

I have a WebService executing on one server in a workgroup which needs
to reach out to a folder share on another server for read/write access.

I've created an identical user account on both systems (matching in
username and password). I've approached the problem by writing a
utility class that calls the Win32 API LogonUser method. The idea was
to have the code temporary impersonate the user account, access the
remote UNC folder share, and then return the context back to normal.

The problem is that well... it's just not working =) As soon as I
call File.Exists(filePath) I always get a false return signifying the
file doesn't exist or I don't have access. Now I've confirmed the user
account on the remote system has read/write permission on the share.

Any ideas?
 
D

David Coe, MCP

It sounds like one of two things is happening. Either the account that is running ASPNET is not functioning correctly (if it is running as another user aside from ASPNET), or the Win32 LogonUser method is not impersonating the user correctly. Just before you make the call to the LogonUser method, check the Context.User.Identity property to see what ASPNET is running as. If that is functioning correctly, I would focus on the impersonation in the Win32 call.
 
G

Garrek

Thanks David, I'll take a look at the Context.User.Identity and see
what's going on.
 
P

Prodip Saha

Garrek,
I experienced the similar problem but got it resolved using a technique
called Mirrored Account. I found this the simpliest possible solution.
Search microsoft site for 'Mirrored Account' for additional help.

Prodip
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top