About formsauthentication. redirectfromloginpage () Context. User. Identity. Name

Source: Internet
Author: User
Look at other people's code and find the following sentence:
Formsauthentication. redirectfromloginpage (userid, false );
Can be redirected to another page, but I didn't specify the page to be redirected here,
I used to have configuration in Web. config.
[Code] <Authentication mode = "forms">
<Forms loginurl = "login. aspx"> </Forms>
</Authentication>
<Authorization>
<Deny users = "? "/>
</Authorization> [/Code]
Haha, this is a good thing. When using form authentication, if you do not log on, no matter which page you open, you will go to the specified logon page. After logging on, can return the page you specified...

Authentication mode = "forms">
<Forms loginurl = "login. aspx"> </Forms>
</Authentication>
----------------------------- The above is the identity verification
----------------- The following are authorized
<Authorization>
<Deny users = "? "/>
</Authorization>

Redirects authenticated users back to the original requested URL

 

Why is context. User. Identity. name always blank ??
Create an ihttpmodule and register it in Web. config.
Then, user tags are recorded in cookies or sessions,
During each application. axxxxxrequest (I do not know how to write, verify the request), the context. User = new myprincipal (userid) is re-executed based on the session information based on cookies );

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.