Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem creating directories through asp.net

Reply
Thread Tools

Problem creating directories through asp.net

 
 
Stimp
Guest
Posts: n/a
 
      03-08-2006
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 falling down on the 'CreateDirectory' function.

The error I'm getting is:

"Could not find a part of the path "E:\"."


Here's the code where the site falls down:

Directory.CreateDirectory(Server.MapPath("members\ " & sUserName.ToLower))


My host provider has no idea why it is happening.. what could be the
reason?

Thanks,
Peter
--

fiddlewidawiddum
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      03-08-2006
Peter,

Must be they changed something in security. Now you are in trouble of
finding what do you have change to accomodate their change.

Eliyahu

"Stimp" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 falling down on the 'CreateDirectory' function.
>
> The error I'm getting is:
>
> "Could not find a part of the path "E:\"."
>
>
> Here's the code where the site falls down:
>
> Directory.CreateDirectory(Server.MapPath("members\ " & sUserName.ToLower))
>
>
> My host provider has no idea why it is happening.. what could be the
> reason?
>
> Thanks,
> Peter
> --
>
> fiddlewidawiddum



 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      03-08-2006
> 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 falling down on the 'CreateDirectory' function.
>
> The error I'm getting is:
>
> "Could not find a part of the path "E:\"."
>
>
> Here's the code where the site falls down:
>
> Directory.CreateDirectory(Server.MapPath("members\ " & sUserName.ToLower))
>
>
> My host provider has no idea why it is happening.. what could be the
> reason?
>
> Thanks,
> Peter


By default the account that ASP.Net uses has no rights to create
directories or write to the filesystem. Apparently the access rights
that did grant you "create directory" rights have changed.
Did your provider change the default ASPNET user?
Did your provider move your site to a different physical directory?
What happened two weeks ago?

Hans Kesting


 
Reply With Quote
 
Stimp
Guest
Posts: n/a
 
      03-08-2006
On Wed, 8 Mar 2006 Hans Kesting <(E-Mail Removed)> wrote:
>> 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 falling down on the 'CreateDirectory' function.
>>
>> The error I'm getting is:
>>
>> "Could not find a part of the path "E:\"."
>>
>>
>> Here's the code where the site falls down:
>>
>> Directory.CreateDirectory(Server.MapPath("members\ " & sUserName.ToLower))
>>
>>
>> My host provider has no idea why it is happening.. what could be the
>> reason?
>>
>> Thanks,
>> Peter

>
> By default the account that ASP.Net uses has no rights to create
> directories or write to the filesystem. Apparently the access rights
> that did grant you "create directory" rights have changed.
> Did your provider change the default ASPNET user?
> Did your provider move your site to a different physical directory?
> What happened two weeks ago?


I just rang my hosting provider there and they told me that they have
upgraded the security on their servers for ASP.NET accounts so that I
can no longer create a folder from the server root directory (i.e. E:\).

Instead, he suggests, I'll need to create a directory from the
Application root.

This means that:
Directory.CreateDirectory(Server.MapPath("members\ blah"))

is not allowed with the Server.MapPath part...

but I'll need to use something else instead like:

Directory.CreateDirectory("members\" & sDirName)

But of course, this doesn't work.

Any suggestions on an alternative CreateDirectory structure?

Thanks,
Peter
--

fiddlewidawiddum
 
Reply With Quote
 
Stimp
Guest
Posts: n/a
 
      03-08-2006
On Wed, 8 Mar 2006 Stimp <(E-Mail Removed)> wrote:
>
> Any suggestions on an alternative CreateDirectory structure?



For those who are interested, I found the solution to this issue:

http://www.codeproject.com/csharp/cr...torymethod.asp

Works like a charm.

--

fiddlewidawiddum
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Directories and Physical directories Paul M Fin MCAD 4 06-27-2008 07:50 PM
virtual directories/physical directories in IIS Paul F ASP .Net 4 06-25-2008 04:04 PM
Multiple bin-directories with virtual directories? =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?= ASP .Net 0 11-09-2004 05:49 PM
How to map Project directories to Production sub-directories Joel Finkel ASP .Net 0 09-12-2003 06:47 PM
Using virtual directories for common directories (scripts, images, styles, etc.) Jeffry van de Vuurst ASP .Net 2 07-30-2003 07:00 PM



Advertisments