473,809 Members | 2,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Directory.Creat eDirectory - Could not find a part of the path

Any ideas how to overcome this problem when accessing a network share within
an asp.net web app?

This runs internally on the network. The following is in my web.config:
<identity impersonate="tr ue"/>
<authenticati on mode="Windows" />

I check WindowsIdentity .GetCurrent().N ame before I attempt my directory
access. By default this has always been PC\ASPNET. Changing the
impersonate to true and turning off anonymous login and using integrated
windows login changes this to domain\user which works when I run it under
localhost. However, when I run it from another pc it fails even though the
user has the appropriate rights.

In testing IIS changes the only setting I found that gave me the desired
results was to force basic authentication in IIS. This gave the unwanted
popup login window when you launch the page, but did everything else
correctly. I was able to create directories assuming the user had the
appropriate rights.

Why would it work under basic and not windows integrated ... at least that
would prevent that extra popup? Under both setups the windowsIdentity Name
is the same.

Thanks,

Andrew

Jan 5 '06 #1
2 2198
setting identity impersonate has the asp.net thread impersonate the identity
of the iis request thread. if you turn off anonymous, this will be the
actual user as you have found.

if iis is setup with windows authenication, then the users secuirty token is
a secondary token (passed from the client machine). the ntlm security (1 hop
rule) prevents the users creditials from being forwarded or used to access
any network resource.

if iis is setup with basic, the username and password is sent to iis, and
iis has a primary token (as it was created by iis itself). in this case the
token can be used to access any network resource with the users security
rights.

you have a third option, that is to enable kerberos security, and enable
creditals forwarding on the servers.

-- bruce (sqlwork.com)
"Andrew R. Jones" <aj****@kvmhc.o rg> wrote in message
news:5c******** *************** ****@LIGHTSHIP. NET...
Any ideas how to overcome this problem when accessing a network share
within an asp.net web app?

This runs internally on the network. The following is in my web.config:
<identity impersonate="tr ue"/>
<authenticati on mode="Windows" />

I check WindowsIdentity .GetCurrent().N ame before I attempt my directory
access. By default this has always been PC\ASPNET. Changing the
impersonate to true and turning off anonymous login and using integrated
windows login changes this to domain\user which works when I run it under
localhost. However, when I run it from another pc it fails even though
the user has the appropriate rights.

In testing IIS changes the only setting I found that gave me the desired
results was to force basic authentication in IIS. This gave the unwanted
popup login window when you launch the page, but did everything else
correctly. I was able to create directories assuming the user had the
appropriate rights.

Why would it work under basic and not windows integrated ... at least that
would prevent that extra popup? Under both setups the windowsIdentity
Name is the same.

Thanks,

Andrew

Jan 5 '06 #2
Thanks very much for the explanation. Obviously there was a difference and
I didn't know what it was.

I am going to explore this third option as I would like this application to
be able to run outside of the company network using a more secure login (
similar to outlook web access ).

If you could point me in the right direction I would greatly appreciate it.

Thanks

AJ

"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:ed******** ******@TK2MSFTN GP09.phx.gbl...
setting identity impersonate has the asp.net thread impersonate the
identity of the iis request thread. if you turn off anonymous, this will
be the actual user as you have found.

if iis is setup with windows authenication, then the users secuirty token
is a secondary token (passed from the client machine). the ntlm security
(1 hop rule) prevents the users creditials from being forwarded or used to
access any network resource.

if iis is setup with basic, the username and password is sent to iis, and
iis has a primary token (as it was created by iis itself). in this case
the token can be used to access any network resource with the users
security rights.

you have a third option, that is to enable kerberos security, and enable
creditals forwarding on the servers.

-- bruce (sqlwork.com)
"Andrew R. Jones" <aj****@kvmhc.o rg> wrote in message
news:5c******** *************** ****@LIGHTSHIP. NET...
Any ideas how to overcome this problem when accessing a network share
within an asp.net web app?

This runs internally on the network. The following is in my web.config:
<identity impersonate="tr ue"/>
<authenticati on mode="Windows" />

I check WindowsIdentity .GetCurrent().N ame before I attempt my directory
access. By default this has always been PC\ASPNET. Changing the
impersonate to true and turning off anonymous login and using integrated
windows login changes this to domain\user which works when I run it under
localhost. However, when I run it from another pc it fails even though
the user has the appropriate rights.

In testing IIS changes the only setting I found that gave me the desired
results was to force basic authentication in IIS. This gave the unwanted
popup login window when you launch the page, but did everything else
correctly. I was able to create directories assuming the user had the
appropriate rights.

Why would it work under basic and not windows integrated ... at least
that would prevent that extra popup? Under both setups the
windowsIdentity Name is the same.

Thanks,

Andrew


Jan 5 '06 #3

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

Similar topics

32
5008
by: munanxue | last post by:
I remember that I could create a new folder in the current directory easily in Unix and Linux by something like system("mkdir sub_directory"); But failed to do so under Windows System. Any suggestions?
1
15890
by: MAF | last post by:
How do I create a directory inside C#?
3
3010
by: Newbie | last post by:
hi! i am able to upload files successfully. but i have one minor problem. files are uploaded correctly if the directory exists, it is throwing an exception if the directory doesnt exist. but the directory name is created during runtime. is there a way to create a directory during runtime? exception: Error saving file C:\temp\188\ System.IO.DirectoryNotFoundException: Could not find a part of the path
1
2426
by: Sparky | last post by:
I want to create a directory on my web server from within code. I've tried using Request.PhysicalApplicationPath() to get the location of the application, and appended my new directory on the end and used Directory.CreateDirectory which fails with: System.IO.DirectoryNotFoundException: Could not find a part of the path "d:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at...
3
2297
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at TestVBProject.createdirectorytest.Page_Load(Object...
23
2444
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
0
2199
by: NewbieDev | last post by:
Hi, I call Directory.CreateDirectory and File.Copy from VB.NET with a UNC path that has a dollar sign ($) - "\\servername\foldername$\childfoldername\" and it gives me this error message: System.IO.DirectoryNotFoundException - Could not find a part of the path "\\servername\foldername$" Do I need to have an absolute path and not a relative path, which the dollar
2
2517
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, I am having a bit of a nightmare with the following: if(!Directory.Exists(folderPath)) Directory.CreateDirectory(folderPath); When I add a watch to this while debugging I see that the value of folderPath is
4
2826
by: Robert | last post by:
Greetings New to Visual Studio 2008. Always us VB6.0 SP5. I am trying to copy files from A to B. I select a directory, and copy files. Works ok, but it does not create the directory first. snippet. Private Sub cmdTo_Click(ByVal sender As System.Object, ByVal e As
4
2573
by: Tom | last post by:
This is really weird, but I have the following code: private static readonly string mString = "tempUnzipDir" + Path.DirectorySeparatorChar; .... public static string ExtractToTempLocation(string aZip) { try
0
9721
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
9601
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
10635
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
10115
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
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3013
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.