UnauthorizedAccessException in webservice accessing files on UNC s

I've been trying to find a solution to my problem and ran across this post on
..NET 247 that describes it exactly:
--------------------------------------------------------------
I am in the process of developing a webservice which [accesses files from a]
UNC path. The problem I am having is accessing the files on the UNC path to a
remote machine within the same domain and on the same network. The error is
System.UnauthorizedAccessException "Access to the path
'\\server\sharename\folder' is denied. If the UNC path points to a folder on
the server running the Web Service everything is fine. For test purposes the
group "everyone" has full access to the UNC Share. I have tried "<Impersonate
/>" without success.

I'm using the System.IO namespace to access the files on the given UNC path.

----------------------------------------------------------------
I followed the various directions in the post to no avail. This webservice
is running in a separate application pool as Network Service on my local
machine, which is running 2003 Server. The UNC share resides on a 2003 Server
within the domain.

This post recommended using the .NET Confiuration tool to give the
localintranet code group full trust. I did that but it didn't work. I've also
created a new code group granting full trust to all assemblies originating
from the webservice URL and that didn't work.

It may be helpful to note that I can successfully query the existence of a
file through File.Exists(), I just can't create a stream.

So to sum up, the webservice is running on my local machine with full trust,
the UNC share is totally wide open and it's still throwing unauthorized
access exceptions when attempting to create a FileStream.

I'm ready to supply any additional information to help diagnose and fix
this. Any ideas?

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!