473,379 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

network (drive) access/impersonate identity problem

I am experiencing difficulty access a mapped network drive in an ASP.NET
application.

While using the .Net framework v 1.1 implementation of
System.IO.Directory.Exists(), it fails to recognize a mapped network drive.

This is true if the path specified uses a mapped drive letter or is
expressed as a UNC address. I have also tried the drive letter and UNC
paths with and without trailing backslashes, respectively.

No luck with ASP.NET, but it does work when I create a simple C# console
test harness application. This indicates to me to be a security concern with
ASP.NET. Funny thing is - no exception is returned. For all combinations,
System.IO.Directory.Exists returns false. (If so, this behavior is very
inconsistent with the System.Security thrown for things like trying to write
to a file, execute code on another machine, etc.)

The following knowledge base article:
307901: INFO: Permissions to Connect to a Remote Access Database from
ASP.NET
http://support.microsoft.com/default...Product=aspnet

recommends using impersonation, but an error occurs even before the 1st line
of my ASP.NET code is executed.
No windows event is logged either.

How do I get the ASP.NET worker process to recognize another machine's hard
drive, folders and files?

Any help is appreciated. Thanks!

--
Peter O'Reilly
Nov 17 '05 #1
2 5655
you can not check for the existance of a file you do not have access
permission to, false is always returned, if an error was thown, you would
know that the file exists.

to access a network share from asp.net, you need to run under a domain
enabled primary secuirty token, the easiest way to do this is to use
impersonation in your web config as the article explained

<identity impersonate="true" userName="<supplied username>"
password="<supplied password>" />

where the user name is a domain account with permission to the resouce. all
users of your web site will have the same access permissions to the network
resource.

-- bruce (sqlwork.com)

"Peter O'Reilly" <Pe***********@timeinc.com!N!O!.S!P!AM!> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
I am experiencing difficulty access a mapped network drive in an ASP.NET
application.

While using the .Net framework v 1.1 implementation of
System.IO.Directory.Exists(), it fails to recognize a mapped network drive.
This is true if the path specified uses a mapped drive letter or is
expressed as a UNC address. I have also tried the drive letter and UNC
paths with and without trailing backslashes, respectively.

No luck with ASP.NET, but it does work when I create a simple C# console
test harness application. This indicates to me to be a security concern with ASP.NET. Funny thing is - no exception is returned. For all combinations, System.IO.Directory.Exists returns false. (If so, this behavior is very
inconsistent with the System.Security thrown for things like trying to write to a file, execute code on another machine, etc.)

The following knowledge base article:
307901: INFO: Permissions to Connect to a Remote Access Database from
ASP.NET
http://support.microsoft.com/default...&Product=aspne
t
recommends using impersonation, but an error occurs even before the 1st line of my ASP.NET code is executed.
No windows event is logged either.

How do I get the ASP.NET worker process to recognize another machine's hard drive, folders and files?

Any help is appreciated. Thanks!

--
Peter O'Reilly

Nov 17 '05 #2
> you can not check for the existence of a file you do not have access
permission to, false is always returned, if an error was thrown, you would
know that the file exists.
Sorry, not so. It could be an authentication error thrown which is one step
before performing an authorization check. Subtle difference here and
querying a directory's existence is analogous to executing a database query,
e.g. you need permission to connect before querying. No knowledge of the
directories existence or DB data is gained when throwing such an error.
to access a network share from asp.net, you need to run under a domain
enabled primary security token, the easiest way to do this is to use
impersonation in your web config as the article explained

<identity impersonate="true" userName="<supplied username>"
password="<supplied password>" />

where the user name is a domain account with permission to the resouce. all users of your web site will have the same access permissions to the network resource.


Yes, I'm aware of that. However as I mentioned before it is not working for
me as mentioned before.
To provide more detail...I am using the same userName and password used to
map to the network drive
and access its folders. I've also tried prefixing the username with the nt
domain name it is associated with to no avail. I've tried a few other
accounts to no avail.

Now turning off custom errors, I get the following parse error message:

Could not create Windows user token from the credentials specified in the
config file. Error from the operating system 'A required privilege is not
held by the client. '

Which sizing up the MS knowledge base, it documents:
PRB: Per Request Impersonation Does Not Work on Windows 2000 with ASP.NET
http://support.microsoft.com/default...b;en-us;810204

Their recommended workaround solution, just specify <identity
impersonate="true"/>, e.g. impersonating IIS is not going to work for me.
Upgrading to Win 03 is not an option at this time either.

Is this issue fixed in Service Pack 3 of Win2k?
--
Peter O'Reilly
Nov 17 '05 #3

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

Similar topics

8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
0
by: Christian Binder | last post by:
Hi folks. got a problem: i want to connect to an access db which is located on a network drive (seperate server). The server's name, where the access db is located, is "SERVER001" and the server,...
2
by: Michal Valent | last post by:
Hello, if I try to read a file on the mapped network drive, this error apears: Logon failure: unknown user name or bad password. How to set up permissions for IUSR_MACHINENAME on the mapped...
5
by: Dave Kolb | last post by:
Is there any other solution for an ASPNET application to access network resources other than running as SYSTEM, using delegation (a nightmare to get to work) or the COM+ solution? I cannot seem to...
11
by: Andre | last post by:
Hi, I have ASP.NET application running on standalone (not part of the domain) Windows 2003. I use forms authentication for my application. The problem I have is that I need to create and read...
5
by: Abraham Andres Luna | last post by:
hey everyone, i try to access a network drive using asp.net: File.Delete(@"W:\text.txt"); but i get this error message: System.IO.DirectoryNotFoundException: Could not find a part of the...
3
by: Michel Smit | last post by:
Hello, I have a question. We have a webserver in a domain, DomainA, and a webserver in a DMZ with local users and groups only. I'm trying to copy a file from the DomainA webserver to the DMZ...
1
by: Piyush Trivedi | last post by:
I am experiencing difficulty to access a mapped network drive in an ASP.NET application. While using the .Net framework v 1.1 implementation of System.IO.Directory.Exists() to check if the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.