473,385 Members | 1,465 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,385 software developers and data experts.

Problem with System.IO.Directory.CreateDirectory in ASP.NET application.

I am trying to dynamically create directories in my ASP.NET application (I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a part
of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does not
allow my read access above my wwwroot folder which seems to be a problem
when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/
Nov 18 '05 #1
7 1061
Eran,

ASP.NET usually runs under account that doesn't have file writing rights at
all. Speak to your ISP.

Eliyahu

"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application (I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a part of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does not allow my read access above my wwwroot folder which seems to be a problem
when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/

Nov 18 '05 #2
the ASPNET user...
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OB*************@TK2MSFTNGP15.phx.gbl...
Eran,

ASP.NET usually runs under account that doesn't have file writing rights at all. Speak to your ISP.

Eliyahu

"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a

part
of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does

not
allow my read access above my wwwroot folder which seems to be a problem
when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/


Nov 18 '05 #3
The ASP.NET worker process user has file writing capabilities under my
specific folder (it can create\modify files in existing directories).
The problem is when trying to create a new directory....

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OB*************@TK2MSFTNGP15.phx.gbl...
Eran,

ASP.NET usually runs under account that doesn't have file writing rights
at
all. Speak to your ISP.

Eliyahu

"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application
(I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a

part
of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does

not
allow my read access above my wwwroot folder which seems to be a problem
when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/


Nov 18 '05 #4
So why do I get a wierd "Could not find a part of the path "D:\" exception
instead of a security exception (unauthorized access or something) ?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OB*************@TK2MSFTNGP15.phx.gbl...
Eran,

ASP.NET usually runs under account that doesn't have file writing rights
at
all. Speak to your ISP.

Eliyahu

"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application
(I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a

part
of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does

not
allow my read access above my wwwroot folder which seems to be a problem
when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/


Nov 18 '05 #5
Have you tried just writing out the string you are generating
from Server.MapPath("/") + "test" ?
What have you got there?

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application (I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a
part of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does
not allow my read access above my wwwroot folder which seems to be a
problem when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/

Nov 18 '05 #6
Yes, you get all sort of wierd exceptions when you run into security
problems. You are right about writting into existing folders, but I am not
sure if creating directories is the same permission as writting files.

Eliyahu

"Eran Kampf" <er**@ekampf.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
So why do I get a wierd "Could not find a part of the path "D:\" exception
instead of a security exception (unauthorized access or something) ?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:OB*************@TK2MSFTNGP15.phx.gbl...
Eran,

ASP.NET usually runs under account that doesn't have file writing rights
at
all. Speak to your ISP.

Eliyahu

"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application
(I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a

part
of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does
not
allow my read access above my wwwroot folder which seems to be a

problem when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/



Nov 18 '05 #7
Yes I tried that.
Same error

I even tried using DirectoryInfo to get to the wwwroot dir and then creating
a subdirectory and got the same exception...

"Dennis Myrén" <de****@oslokb.no> wrote in message
news:IH******************@news4.e.nsc.no...
Have you tried just writing out the string you are generating
from Server.MapPath("/") + "test" ?
What have you got there?

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Eran Kampf" <er**@ekampf.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
I am trying to dynamically create directories in my ASP.NET application (I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a
part of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does
not allow my read access above my wwwroot folder which seems to be a
problem when trying to create directories...

Is there any way to solve this?

--
Eran Kampf
blog: http://www.ekampf.com/blog
Sharp3D.Math: http://www.ekampf.com/Sharp3D.Math/


Nov 18 '05 #8

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

Similar topics

5
by: matt dittman | last post by:
I have created a windows service that reads emails from a drop directory and moves them to the appropriate mail folder every 15 seconds. I can move, rename and delete the files as needed, up...
6
by: Chad | last post by:
I am receiving the following two errors in the code below. Both are on Line 56. error C2039: 'CreateDirectoryA' : is not a member of 'System::IO::Directory' error C2660: 'CreateDirectoryA' :...
4
by: Daniel | last post by:
If i log into my computer as domain A and user X and password Y but then I need to give C# application access to domain B as user F and password G. Is this possible? or do i have to log into the...
4
by: Snake | last post by:
Hello, I'm developping an application which has to create a directory on a remote server. I'm using the createdirectory API fonction which works well when the PC runs win2000. Now, when I use...
5
by: Arsalan Ahmad | last post by:
Hi all, I am developing a simple one page application in ASP.NET which takes an input in a text box and print in a label. But when i uploaded it to the website i get the following error: ...
3
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...
5
by: Philip Wagenaar | last post by:
I have a Windows Form application that monitors a directory using the System.IO.FileSystemWatcher. On the event created I run a sub that sends an xml file over http to a service. When I copy...
4
by: Stimp | last post by:
When a user registers with my site, I create a separate folder for them (for uploading photos, etc). The code for this has been working fine for 1 year, but over the past 2 weeks it has been...
1
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
4
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...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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.