Can't write to a text file. Please advise
First off, FYI - my version of .NET Framework 1.1 is (version 1.1.4322.573). So I believe it has the most current service packs. I get the following error message [UnauthorizedAccessException: Access to the path "c:\inetpub\wwwroot\Sessions\MyTextFile.txt" is denied.] and furthemore it says: "ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user"
I don't know what any of that means!
I have looked out on google for the following string "ASP.NET is not authorized to access the requested resource." So I have found other folks have had this error too, but yet again I don't understand their solutions.
NOTE: I am able to write ASP 3.0 applications that write to files. BUT - I had a similar problem when I first began to do ASP 3.0. The issue turned out to be a security issue. I went to --> Default web site properties > Directory Security tab,, I saw that "secured user" was set up to be some weird id. I changed it to be the name of my local computer. I also set the unchecked ALLOW IIS TO CONTROL PASSWORD. and that fixed my ASP 3.0 issues. So what is my trouble this time as I try to do ASP.NET applications.
It does not seem to matter what file path I use for the text file I am trying to write. Here is the actual line of code that is going down -
Dim MyTextFile As StreamWriter
MyTextFile = New StreamWriter("c:\inetpub\wwwroot\Sessions\MyTextFi le.txt"", True) ' <--Boom right here!
Cmarek
__________________
Cmarek
|