473,592 Members | 2,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File access problems

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.Unautho rizedAccessExce ption: Access to the path <UNC path> is denied.

The error occurs when I hit this line.
Dim fw As New
StreamWriter(Sy stem.Configurat ion.Configurati onSettings.AppS ettings("FilePa th"), False)

The FilePath is just \\machinename\s haredfolder\fil e

thank you,

--
Duffman

can't get enough of that wonderful Duff
Nov 23 '05 #1
1 8117
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.Unautho rizedAccessExce ption: 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

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: AcXJHKxu7A9lpLC ARIOaqFPDDQRmQw ==
X-WBNR-Posting-Host: 206.230.64.253
From: "=?Utf-8?B?RHVmZm1hbg= =?=" <Du*****@newsgr oup.nospam>
Subject: File access problems
Date: Tue, 4 Oct 2005 12:49:03 -0700
Lines: 25
Message-ID: <E7************ *************** *******@microso ft.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.publi c.dotnet.framew ork.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
microsoft.publi c.dotnet.framew ork.webservices :8107
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.Unautho rizedAccessExce ption: Access to the path <UNC path> is
denied.

The error occurs when I hit this line.
Dim fw As New
StreamWriter(Sy stem.Configurat ion.Configurati onSettings.AppS ettings("FilePa t
h"), False)

The FilePath is just \\machinename\s haredfolder\fil e

thank you,

--
Duffman

can't get enough of that wonderful Duff

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
10132
by: simon place | last post by:
is the code below meant to produce rubbish?, i had expected an exception. f=file('readme.txt','w') f.write(' ') f.read() ( PythonWin 2.3 (#46, Jul 29 2003, 18:54:32) on win32. ) I got this while experimenting, trying to figure out the file objects modes,
9
15746
by: John | last post by:
Hi All, I have encountered a problem with the ldb file of a database. When making changes to the backend databases I need exclusive access to make changes. I usually do this at night when all users have left the premises, but for the last couple of nights there are no users using the database and the ldb file is still visible even though I'm sure nobody is using the database. I have tried to manually delete the lbd file but the...
11
2259
by: stu | last post by:
I have several databases that are opened using various versions of Access and VB. Up till recently everything worked fine, then I started getting a variety of lock file error messages, both on my PC and other computers (both Win2k and WinXP). After a lot of testing I found that if the database was opened by Access 2.0 (or a VB3 16 bit application), and then subsequently a Access 2000 (or VB6 32 bit application) opened the database, then...
4
8315
by: Mountain Bikn' Guy | last post by:
I am having serious problems with the following IDE bug: Could not write to output file 'x.dll' -- 'The process cannot access the file because it is being used by another process. ' and BUG: "Could Not Copy Temporary Files to the Output Directory" Error Message When You Build a Solution That Contains Multiple Projects I have tried all the solutions in Microsoft Knowledge Base Article - 313512.
2
1594
by: Joey | last post by:
I have a web app that uses forms authentication. The app also has a downloads section, and I need to be able to use <location> tags to control access to the downloadable files there (preferably by directory instead of individual file.) I understand that this behavior does not occur by default because IIS does only maps certain file types (i.e. "*.aspx") to asp.net by default. In other words, any user can download files that are within...
8
9733
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
1
6466
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
1
47430
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
7935
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7871
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8227
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5400
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2379
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1202
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.