Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2005

Tip: Looking for answers? Try searching our database.

File access problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Duffman - 04 Oct 2005 20:49 GMT
Hi,

I have what seems to be a common problem, but the solutions I've found don't
seem to work.  I would like to use a web service to create a file at a UNC
location in a shared file.  Currently I'm just running it locally and saving
the file locally using my machines UNC path.

I have given user ASPNET full control over the folder I want to write the
file to.  I've also tried using the web config identity impersonation to use
my user with full access to the folder.
In each case I error out with the
:System.UnauthorizedAccessException: Access to the path <UNC path> is denied.

The error occurs when I hit this line.
Dim fw As New
StreamWriter(System.Configuration.ConfigurationSettings.AppSettings("FilePath"), False)

The FilePath is just  \\machinename\sharedfolder\file

thank you,

Signature

Duffman

can't get enough of that wonderful Duff

Steven Cheng[MSFT] - 05 Oct 2005 07:14 GMT
Hi Duffman,

Welcome to MSDN newsgroup.
From your description, you're trying to access and modify a remote UNC
shared folder in your asp.net webservice's webmethod and you're getting
:System.UnauthorizedAccessException: Access to the path <UNC path> is denied.
which indicate the permission issue, yes?

As for such scenario, there're several things need to pay attention. First
our asp.net webservice's security configuration.
What's your asp.net webservice's hosting server, win2k/iis5 or win2k3 iis6,
they'll have different process model. Anyway, we first need to use a
certain account to running the asp.net webservice so that it is valid to
the remote machine. And since the MACHINE\ASPNET account is a local
account, it's not valid one to remote machines.  When using such a account
to access remote resource, the remote server will treat it as a invalid
identity and establish NULL session.   So you can use a domain account or a
duplicated mapping local account( which has the same username/password on
both machines) to run your asp.net webservice.  

Also, you can check the Eventlog on the the remote UNC share's server which
will provide the error info about the access denied error, you can get
what's the identity used to access the fileshare.

In addition, to allow anonymous user access fileshare, we need to grant
everyone the certain permission. And on W2K3server, there is an additional
privillege named
"Network access: restrict anonymous to Named pipes and shares"

by default it's enabled, you'll need to disable it so as to allow anonyous
access file share.

Thanks,

Steven Cheng
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
Thread-Topic: File access problems
thread-index: AcXJHKxu7A9lpLCARIOaqFPDDQRmQw==
X-WBNR-Posting-Host: 206.230.64.253
From: "=?Utf-8?B?RHVmZm1hbg==?=" <Duffman@newsgroup.nospam>
Subject: File access problems
Date: Tue, 4 Oct 2005 12:49:03 -0700
Lines: 25
Message-ID: <E7BFC1C2-1A7E-47BA-B5C1-8368514CBA15@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
    charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.webservices:8107
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,

I have what seems to be a common problem, but the solutions I've found
don't
seem to work.  I would like to use a web service to create a file at a UNC
location in a shared file.  Currently I'm just running it locally and
saving
the file locally using my machines UNC path.

I have given user ASPNET full control over the folder I want to write the
file to.  I've also tried using the web config identity impersonation to
use
my user with full access to the folder.
In each case I error out with the
:System.UnauthorizedAccessException: Access to the path <UNC path> is denied.

The error occurs when I hit this line.
Dim fw As New
StreamWriter(System.Configuration.ConfigurationSettings.AppSettings("FilePat
h"), False)

The FilePath is just  \\machinename\sharedfolder\file

thank you,

Signature

Duffman

can't get enough of that wonderful Duff


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.