ASP.NET Ajax Tutorial Lesson 7. Accessing Profile and Authentication Information
printer friendly version
ASP.NET 2 uses a ‘provider’ model, whereby much of the platform is made up of late-bound modules. Two of these modules concern authentication information (who the user is) and profile information (information about how the user has personalised his use of the application).
The AuthenticationService class can be used to perform an Ajax login, either to the standard membership provider or, with a bit of configuration, via a custom process. The login process returns the appropriate forms authentication cookie to the browser.
The ProfileService can is used to retrieve personalisation data following authentication, so that the application can apply personalisation without performing a postback.
In order to access these services, they must be turned on in the web.config. The following example settings are provided but commented out when you create an Ajax-enabled project in Visual Studio:
|
1.
|
<system.web.extensions>
|
|
2.
|
<scripting>
|
|
3.
|
<webServices>
|
|
4.
|
<!--
|
|
5.
|
<authenticationService enabled="true" requireSSL = "true|false"/>
|
|
6.
|
<profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" />
|
|
7.
|
-->
|
|
8.
|
</webServices>
|
|
9.
|
</scripting>
|
|
10.
|
</system.web.extensions>
|
|
|
|