Could not find a part of the path

Could not find a part of the path

Post by goga » Fri, 01 Sep 2006 21:21:48


Hi,

I know query in Subject line "Could not find a part of the path" has
been replied before lots of time, but mine is bit different.

My web server is windows 2003 R2 with both .net framework 1.1 and 2.0
installed on C:\.
Websites are saved on D:\wwwroot
I run the follow code for a website which is running on dedicated pool,
aspx files on 1.1 framework:

If Not directory.Exists(Server.mappath("..\Images\" & i)) then
directory.create(Server.mappath("..\Images\" & i))
end if

When i try to create a sub-folder 22 under D:\wwwroot\<website>\Images\
i get following error:

Could not find a part of the path "D:\"

If i manually create folder 22, then the code works fine to upload
images into that folder.

I googled a lot and tried everything... gave aspnet account full
permissions to D:, tried
http://www.yqcomputer.com/ ;en-us;827421
also set up asp.net service to run using Network Service, restarted
server.. but all in vain

Then i changed the website properties -> ASP.NET tab -> ASP.NET version
from 1.1 to 2.0

And this did the trick and code started working fine.
But i have around 70 websites on this server using .net 1.1, and also I
DONT want to use this approach coz I am sure there must be a workaround
to use both 1.1 and 2.0 on same IIS and running websites properly

Please help!!

Thanx in advance

Warm Regards

PS: I got error in event log that permission denied to
\\<servername>\D$\System Volume Information
when i was running servermapdrive service mentioned in
http://www.yqcomputer.com/ ;en-us;827421
 
 
 

Could not find a part of the path

Post by Gregory A. » Fri, 01 Sep 2006 21:38:29

2003, by design, does not allow path traversal, which means your ASP.NET
code is stuck in its tree. You are attempting to traverse back to root of
the drive and create a folder. You can turn of this security feature in IIS,
if you wish to. I believe there is also a code access security setting in
the machine.config that restricts you.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************

 
 
 

Could not find a part of the path

Post by goga » Fri, 01 Sep 2006 22:18:00

Cheers for the reply.

But how come it works with ASP 2.0 on the same IIS?

And can you please tell me how to
1) "You can turn of this security feature in IIS, if you wish to"
2) "I believe there is also a code access security setting in the
machine.config that restricts you"

Thanks
 
 
 

Could not find a part of the path

Post by goga » Sat, 02 Sep 2006 00:14:43

Ok, i got the solution.

First of all i have Ensim on this server which creates application
pools that run with user credentials (and users are member of
WVH_ANON_USERS_GROUP)

And when i looked on permission settings on D:, this group had special
permission that denies any sort of access on D:

I gave Read Permissions for D: "This folder only" to
WVH_ANON_USERS_GROUP and it started working.

So bottom line is, that when u get such problem, you should first check
which Application Pool you have defined for the website in IIS. Then in
IIS, right click on that application pool -> properties -> Identity
If the second radio button is selected, check the username specified
and make sure that user has got read permissions to D: or the root
drive you want to access

HTH