0

im doing my first asp.net MVC project here,

i need to be able to create a folder for a new user im registering. so i want it to be that when i register a user lets say name is david, a folder named david is also created. purpose is that later i want to save contents for each user.

is there any good tutorial on how to do this? coz i dont have a clue!

i want to learn it.

Psychocryo
  • 2,103
  • 8
  • 26
  • 33

2 Answers2

1
Directory.CreateDirectory(Path.Combine(path, newFolder)); 

It'S basicly that simple but you have to add write access to IIS_IUSR, a quick search result in this post : IIS AppPoolIdentity and file system write access permissions but it depends on witch version of IIS do you use.

Let me know if you need more help!

Community
  • 1
  • 1
VinnyG
  • 6,883
  • 7
  • 58
  • 76
0

See System.IO.Directory.CreateDirectory

A quick note: do not create the folder within your web site structure since this will recycle the app domain. So you need to use some other path as the root and just give the user under which the site is running the relevant permissions.

Determining the correct user can be done in a couple of ways. A quick Internet search for your environment should do the trick.

HTH

Eben Roux
  • 12,983
  • 2
  • 27
  • 48