Problem creating directories through asp.net

S

Stimp

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
 
E

Eliyahu Goldin

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
 
H

Hans Kesting

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
 
S

Stimp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top