Client Application Services - Part 2
page 2 of 10
by Bilal Haidar
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 17136/ 244

Web application host

In order to allow a client application to access the ASP.NET application services, there is a need to create an ASP.NET web application that will function as a host to access the Membership, Role, and Profile services.

The client application will then reference that host application to enable remote access to the services needed.

To start with, we will develop the ASP.NET application and enable only the Membership and Role services for this article.

First of all, create a new ASP.NET website called ASP.NETApplicationServices. The Membership service is enabled automatically and it is configured by default to work with a database located in a SQL Server 2005 Express edition. To change this configuration and allow the Membership service to interact with another database of your own, simply add the following in the web.config configuration file.

Listing 1

<connectionStrings>
<remove name="LocalSqlServer"/>
<add connectionString="Data Source=.\SQL2005;Initial 
Catalog=ClientApplicationServices;Integrated Security=True" name="LocalSqlServer"
providerName="System.Data.SqlClient"/>
</connectionStrings>

The default connection string used is named LocalSqlServer, so by removing it first and then adding it with different connection string properties, allows the configured Membership provider to interact with the database specified.

One addition step is left which is to install the ASP.NET 2.0 Application Services database. This will not be explained in this article, but this blog post shows in details how to do so: Install Application Services Database on Microsoft SQL Server 2000/2005.

What we need is to enable Role management for this application. This can be easily done by adding this configuration section to the web.config configuration file.

Listing 2

<roleManager enabled="true" /> 

Now that the application is configured for Membership and Role management services, a final step is required to give this website a fixed port number since it is using the Visual Studio 2008 internal web server. This is very important in case you are developing the host application as a website which means every time you run this website, VS 2008 will generate a new port number and assign it to the website and this breaks down the connection between the client application and this host application. To remedy the situation, a fixed port number is necessary so that every time VS 2008 runs this website, it will use the same port number. This can be done by accessing the properties page of the website and clicking on the Web tab. If you look under the Servers section, you can find a radio button called Specific port. There you can set the port number you want as shown in Figure 1.

Figure 1: ASP.NET website Web tab

The current configuration is enough to start creating the client application to authenticate and authorize users.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 6 and 6 and type the answer here:

User Comments

Title: Good Article   
Name: Adron
Date: 10/20/2008 12:07:25 AM
Comment:
Good write up. I'm working through multiple scenarios right now with this, so it is interesting to read and helpful.

Thx.

Product Spotlight
Product Spotlight 






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 11/8/2009 12:24:04 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search