Transform impersonating in Asp.net

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.