We all know that in Asp.net Yes Impersonating, The most common method is IIS To Anonymous Accessed Impersonating.Here I just want to say , After Anonymous Accessed Impersonating In yourProgramNot all of them use this account for permission access.
For example, you need to create and write a log file under the root directory of the program.(For exampleC: \ mydotnet \ myapp1 \ myapp1.log), while I set anonymous impersonating to localhost \ testaccount. ThereforeInGlobal. aspx. CSMedium
Protected Void Application_start (Object sender, eventargs E)
{
// Open the log file
String path = Server. mappath ( "" ) + " \ Myapp1.log " ;
Textwriter File = New Streamwriter (path, True );
}
Which account do you think Asp.net will use to create the myapp1.log file? Is it localhost \ testaccount? No. The system uses the application pool account that your application belongs to. The default applicatoin pool account is network service.
Therefore, if you want to run the preceding program segment, you must have the write permission for the network service account c: \ mydotnet \ myapp1.
For allCodeThe system uses the localhost \ testaccount account. (Global. aspx. CS does not belong to page)