The performance of impersonate applications in different authentication types of Windows/forms!

Source: Internet
Author: User
Tags hosting

First, I wrote the following code on the page to output three different credential types.

Response. Write ("thread:" + thread. currentprincipal. Identity. Name + "<br/> ");
Response. Write ("windws identity:" + windowsidentity. getcurrent (). Name + "<br/> ");
Response. Write ("httpcontext:" + User. Identity. Name + "<br/> ");

Thread: the identity of the output hosting thread.

Window identity: Output OS identity. Generally, it is nt authority \ network service, because. Net frameworkboarding is in w3wp.exe (IIS> 6.0 ).

Httpcontext: identifies the current context credential.

If you are using Windows authentication, thread and httpcontext are empty, but Windows identity is: nt authority \ network service.

Therefore, if you set impersonate = 'true', then Windows identity: nt authority \ IUSR
Because impersonate simulates the window account.

If you are using Forms authentication, log on:

Thread: Gary
Windws identity: nt authority \ Network Service
Httpcontext: Gary
So we can see that thread and httpcontext are set in the hosting environment. By the way, when you enable Windows authentication, you want to set form authentication to enable authority.

<Authorization>
<Allow roles = "role1"/>
<Deny users = "*"/>
</Authorization>

The error 401 unauthority is always returned. Because it is not an adminstrate Group

Related Article

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.