New Developer
New Developer

Reputation: 3305

create file on localhost (Web server physical path)

Currently I am working on asp.net website and I am not very much familiar with asp.net. I have a WebForm and when user clicks on Submit button a .txt file should be get created on server(Text File name is ID entered by user which is unique.)
I used following to create the file.

File.Create( Server.MapPath("~") + id + @".txt");  

But this gives me error when the site is running on the localhost of my pc.
Access to the path 'C:\inetpub\wwwroot\XXX\YYY.txt' is denied.

This is something related with access permission. What should I do to fix this. Please advice me.

Upvotes: 0

Views: 3109

Answers (2)

Youssef Had
Youssef Had

Reputation: 157

File.Create(@"\\127.0.0.1\www\test\test.txt");  

Upvotes: 0

IrishChieftain
IrishChieftain

Reputation: 15253

Add write permission for NETWORK SERVICE to the folder in question.

Upvotes: 2

Related Questions