473,320 Members | 1,853 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,320 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/
Jul 21 '05 #1
7 5243
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/

Jul 21 '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/


Jul 21 '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/


Jul 21 '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/


Jul 21 '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/

Jul 21 '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/



Jul 21 '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/


Jul 21 '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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.