(c) 2002 Visual Studio Magazine 
Fawcette Technical Publications

Issue: June 2002
Section: Improve ASP.NET Application Performance
Author: Paul Delcogliano
Zip file name: vs0206pd

The sample code project includes two ASPX pages. The UsingPostback.aspx page 
uses ASP.Net Event Handling (postbacks) to re-populate the form every time 
the user changes a value in the dropdown. This form is included in the 
project for comparison purposes. The UsingBehavior.aspx page makes the same 
method calls as the UsingPostback.aspx page, but uses the WebService 
Behavior to handle the dropdown's onChange event. When dealing with large 
sets of data or a lot of form controls / elements, you'll quickly notice the 
performance differences between the two forms. 


Follow the steps below to create the sample application on your pc...

- Create a new ASP.Net Web Application from Visual Studio.Net

- Name the application http://localhost/WSBehaviorClient

- Add a reference to System.Web.Services.dll by right clicking on the References folder in the solution explorer and selecting Add Reference. Select System.Web.Services.dll from the list on the .NET tab, click the Select button at the right and finally click the OK button at the bottom of the dialog.

- The following files should be extracted from the CodeAndSQLScript.zip file to C:\InetPub\wwwroot\WSBehaviorClient\:
	cProducts.vb
	cPRoductsWebService.*
	UsingBehavior.*
	UsingPostBack.*
	webservice.htc

- From VS.Net, right click on the project name and select Add | Add Existing Item, from the menu. From the Open dialog, navigate to the c:\InetPub\wwwroot\WSBehaviorClient folder and select all of the files you extracted above. Click Open.

- Open the global.asax.vb file and edit the code. In the Session_onStart event procedure add the following line:
	Session.Add("DBConnection", "Data Source=localhost;Initial Catalog=Northwind;User Id=sa;Password=;")
You will have to replace the data source, user id and password with values that are specific to your instance of SQL Server.

- From the solution explorer window in the IDE, right click on the UsingBehavior.aspx file and choose "Set as Start Page" from the menu.

- Extract the StoredProcs.sql file from the CodeAndSQLScript.zip file and run the file from Query Analyzer. This will create the stored procs needed by the sample application.

- Click the "Run" button from the VS.Net IDE to execute the code.