Headaches with UNC and FileSystemWatcher

B

brian

Hello all.

I've created a FileSystemWatcher (ASP.Net w/VB.Net code
behind pages) that is to reside on Server A and monitor
the activity of folder on Server B.

The application works fine with watcher.path set to C:\.
However, when I specify any other drive for the
watcher.path, I receive an error message telling me the
selected path is invalid.

On my local machine Server B is mapped as W:\. I've tried
using the physical path as in watcher.path = "W:\RFTest",
as well as attempting to use the URL. All attempts result
in the same tired error message.

Any assistance will be greatly appreciated.

Thanks!

Brian.
 
T

Tom Mertens

Using mapped drives will not work, since they are only
mapped for the currently logged on user. Because your
application is an ASP.NET application, it (the ASP.NET
worker process)Y runs under the credentials of
<localmachine>\ASPNET (Windows 2000) or
<localmachine>\NETWORK SERVICE (Windows Server 2003).
These are not the credentials with which you logged on.

The monitors works on C:\ because the account used by
ASP.NET has enough access rights on C:\ (which could be
considered as a security issue though...). The reason it
won't work on your file share, is that the ASP.NET account
doesn't have privileges on the remote server's share.

You can try to run your ASP.NET applications under
different credentials (change required to machine.config)
or you can use impersonation to get the necessary
privileges to connect to the file share.
 

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

Top