Search code examples
c#iis-express

IIS Express Access denied


I am trying to create new file in visual studio 2012

fileStream = new FileStream("google_com.txt", FileMode.CreateNew);

But i keep getting this error Access to the path 'C:\Program Files (x86)\IIS Express\google_com.txt' is denied.

Plz help to fix this poblem.


Solution

  • Solutions:

    1. Put a specific location for google_com.txt file. like C:\google_com.txt. Actually it is not allowing to create the file in default location(inside program files) as it might not have the proper privilege.
    2. If you want to create the file in default location(inside program files) run Visual Studio as Administrator.(R-Click-> Run as Administrator).