Ajax learning notes (15): Use the authentication service provided by ASP. NET Ajax

Source: Internet
Author: User
1. Forms authentication
Httpcontext. Current. User. Identity current user authentication information class (when Asp.net authentication model is used)
At login: formsauthentication. setauthcookie () method
When logging out: formsauthentication. sigout () method
2. authentication service authentication (Ajax)
Configuration in Web. config:
<Authenticationservice enabled = "true" requiressl = "true"/>
At login: SYS. Services. authenticationservice. login (
Username, // User Name
Password, // Password
Ispersistent, // whether to generate a persistent cookie
Custoninfo, // reserved field
Redirecturl, // jump path after successful login
Logincompletedcallback, // callback function after verification, no exception
Failedcallback, // callback function after verification fails
Usercontext // context object specified by the user
)
Function logincompletedcallback (
Validcredentials, // whether the verification is successful
Usercontext ,//
Methodname // login ()
){..}
Function failedcallback (
Error, // error object
Usercontext ,//
Methodname //
}
When logging out: Logout
SYS. Services. authenticationservice. logout (
Redirecturl ,//
Logoutcompletedcallback ,//
Failedcallback, // callback function after cancellation fails
Usercontext //
);
Function logoutcompletedcallback (
Result ,//
Usercontext ,//
Methodname //
){..}
Function failedcallback (
Error ,//
Usercontext ,//
Methodname //
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.