0

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.

New Developer
  • 3,245
  • 10
  • 41
  • 78

2 Answers2

2

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

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
0
File.Create(@"\\127.0.0.1\www\test\test.txt");  
Youssef Had
  • 137
  • 1
  • 2
  • 6