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 //
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.