Chapter 4 Quick Reference


Chapter 4 Quick Reference

To

Do this

Example

Store information in the Application collection

Use either the Application object or the Application.Contents collection to add the item to the collection, or use the Application.Add method.

Application (key) = value
Application.Contents(key) = value
Application.Add(key, value)

Modify information in the Application StaticObjects collection

Add an <Object> tag in Global.asax with the runat="server" attribute and the scope= "application" attribute.

<object runat="server"
scope="Application"
></ object>

Store session state in a dedicated server process

Modify the sessionState configuration section of your application’s Web.config file, changing the mode attribute to StateServer and the stateConnectionString attribute to the appropriate IP address and TCP port for the state server being used.

<sessionState
mode="State
Server"stateConnection
String= "tcpip=127.0.0.1:42424"/
>

Store session state in a SQL Server database

Modify the sessionState configuration section of your application’s Web.config file, changing the mode attribute to SQLServer and the sqlConnectionString attribute to the appropriate data source name, user ID, and password for the SQL Server being used.

<sessionState
mode="SQLServer"sql
ConnectionString= "data
source=127.0.0.1;
user id=sa;password="/
>

Provide support for session state without cookies

Modify the sessionState configuration section of your application’s Web.config file, changing the cookieless attribute to true.

<sessionState cookieless="true"/>




Microsoft ASP. NET Programming with Microsoft Visual Basic. NET Version 2003 Step by Step
Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Version 2003 Step By Step
ISBN: 0735619344
EAN: 2147483647
Year: 2005
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net