ASP.NET 2.0 Application Services introduced Profile objects.
As explained in part one of this series, Profile object holds data per user in
an application. That data is stored inside the database and it is preserved for
all visits.
To enable accessing those Profile objects in the Windows
client application, there should be a way to tell the Windows client
application where to load and where to save those Profile objects.
First of all, we will configure the ASP.NET host application
to enable Profile service and add a few Profile objects that we will import
later on to the Windows client application.
Start with adding the following XML configuration to the
Web.config configuration file.
Listing 1
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" requireSSL = "false"/>
<roleService enabled="true"/>
<profileService enabled="true"
readAccessProperties="LastLoginDate,Back_Color"
writeAccessProperties="LastLoginDate,Back_Color" />
</webServices>
</scripting>
</system.web.extensions>
The new section added in here is enabling the ASP.NET 2.0
AJAX 1.0 Extensions Profile service and configuring two Profile objects for
read and writes by the client, whether the client is an AJAX or a Windows
client application.
When the application is an AJAX one, a client-side proxy is
created that points to the Profile_JSON_AppService.axd HttpHandler. This
handler will execute on the server and access the Profile provider configured.
Once the ASP.NET 2.0 AJAX 1.0 Extensions application
services are configured, the Profile service should also be enabled and
configured as follows.
Listing 2
<profile enabled="true" >
<properties>
<add name="LastLoginDate" type="DateTime"
readOnly="false" serializeAs="String" allowAnonymous="false" />
<add name="Back_Color" type="System.String"
readOnly="false" serializeAs="String" allowAnonymous="false" />
</properties>
</profile>
This is a typical Profile service configuration for an
ASP.NET 2.0 application. First of all, Profile service is enabled then two
Profile objects were configured and added. Nothing new in here!