Abhimanyu K Vatsa

Abhimanyu K Vatsa

  • NA
  • 40.4k
  • 21.4m

Dynamic Creation of Directory in IIS is not working

Apr 28 2011 5:50 AM
I'm developing a simple ASP.NET Website on desktop, the code for creating directory given below works perfect. But when I place the same site under IIS prompt the error.

My Create Directory Code:-
Directory.CreateDirectory(root + "\\users\\2011\\" + username);

[Here String root = Server.MapPath("~"); and String username=txtUsername.text]

My Error Msg when site under IIS:-
Access to the path 'C:\inetpub\wwwroot\Website1\users\2011\sillyme' is denied.

Note, in above line 'sillyme' is new directory name.

Maybe this is an issue for some permission to create dynamic directory inside IIS because when I place my site outside IIS or say on desktop works fine.

How to fix or say grant permission to create the dynamic folder under IIS?

Answers (2)