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.
Solutions:
google_com.txt
file. likeC:\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.Official Microsoft response:
https://support.microsoft.com/es-ve/help/910449/troubleshooting-common-permissions-and-security-related-issues-in-asp
Run Visual Studio as Administrator
You can't write to the Program Files folders on Windows Vista or later unless you're running elevated/as an administrator.
You should be writing to the application's App_Data folder if you need to write anywhere. Look into using Server.MapPath().
If this is in a web app, the file will be created in the application's root, which in this case is your iis express directory. Run Visual Studio as Administrator, or change the location of the file by specifying an explicit path.