Επεξεργασία

Κοινή χρήση μέσω


SqlServices.InstallSessionState Method

Definition

Installs components for ASP.NET session state on a SQL Server database.

Overloads

InstallSessionState(String, String, SessionStateType)

Installs components for ASP.NET session state on a SQL Server database.

InstallSessionState(String, SessionStateType, String)

Installs components for ASP.NET session state on a SQL Server database.

InstallSessionState(String, String, String, String, SessionStateType)

Installs components for ASP.NET session state on a SQL Server database.

InstallSessionState(String, String, SessionStateType)

Installs components for ASP.NET session state on a SQL Server database.

public:
 static void InstallSessionState(System::String ^ server, System::String ^ customDatabase, System::Web::Management::SessionStateType type);
public static void InstallSessionState (string server, string customDatabase, System.Web.Management.SessionStateType type);
static member InstallSessionState : string * string * System.Web.Management.SessionStateType -> unit
Public Shared Sub InstallSessionState (server As String, customDatabase As String, type As SessionStateType)

Parameters

server
String

The SQL Server instance on which to install the session-state components.

customDatabase
String

The database on which to install the session-state components.

type
SessionStateType

One of the SessionStateType values, specifying the type of session state to install.

Exceptions

The type is Custom and the customDatabase value is not supplied, or the type is either Temporary or Persisted and the customDatabase value is not null.

Unable to connect to the specified database server.

An exception occurred while processing the SQL statements required for the operation.

Examples

The following code example shows how to use the InstallSessionState method of the SqlServices class.

// Install temporary session state.
SqlServices.InstallSessionState(server, null,
    SessionStateType.Temporary);
' Install temporary session state.
SqlServices.InstallSessionState(server, Nothing, _
    SessionStateType.Temporary)

Remarks

If server is null or not supplied, SqlServices will use the default SQL Server instance.

Note

The connection to the database server is made with a trusted connection.

See also

Applies to

InstallSessionState(String, SessionStateType, String)

Installs components for ASP.NET session state on a SQL Server database.

public:
 static void InstallSessionState(System::String ^ customDatabase, System::Web::Management::SessionStateType type, System::String ^ connectionString);
public static void InstallSessionState (string customDatabase, System.Web.Management.SessionStateType type, string connectionString);
static member InstallSessionState : string * System.Web.Management.SessionStateType * string -> unit
Public Shared Sub InstallSessionState (customDatabase As String, type As SessionStateType, connectionString As String)

Parameters

customDatabase
String

The database on which to install the session-state components.

type
SessionStateType

One of the SessionStateType values, specifying the type of session state to install.

connectionString
String

The connection string to use. The connection string is only used to establish a connection to the database server. Specifying a database in the connection string has no effect.

Exceptions

The type is Custom and the customDatabase value is not supplied, or the type is either Temporary or Persisted and the customDatabase value is not null.

Unable to connect to the specified database server.

An exception occurred while processing the SQL statements required for the operation.

Examples

The following code example shows how to use the InstallSessionState(String, SessionStateType, String) method of the SqlServices class.

// Install a custom session state database.
SqlServices.InstallSessionState(database,
    SessionStateType.Custom,
    connectionString);
' Install a custom session state database.
SqlServices.InstallSessionState(database, _
    SessionStateType.Custom, _
    connectionString)

See also

Applies to

InstallSessionState(String, String, String, String, SessionStateType)

Installs components for ASP.NET session state on a SQL Server database.

public:
 static void InstallSessionState(System::String ^ server, System::String ^ user, System::String ^ password, System::String ^ customDatabase, System::Web::Management::SessionStateType type);
public static void InstallSessionState (string server, string user, string password, string customDatabase, System.Web.Management.SessionStateType type);
static member InstallSessionState : string * string * string * string * System.Web.Management.SessionStateType -> unit
Public Shared Sub InstallSessionState (server As String, user As String, password As String, customDatabase As String, type As SessionStateType)

Parameters

server
String

The SQL Server instance on which to install the session-state components.

user
String

The user name to use when connecting to the database.

password
String

The password to use when connecting to the database.

customDatabase
String

The database on which to install the session-state components.

type
SessionStateType

One of the SessionStateType values, specifying the type of session state to install.

Exceptions

The type is Custom and the customDatabase value is not supplied, or the type is either Temporary or Persisted and the customDatabase value is not null.

Unable to connect to the specified database server.

An exception occurred while processing the SQL statements required for the operation.

Examples

The following code example shows how to use the InstallSessionState(String, String, String, String, SessionStateType) method of the SqlServices class.

// Install persisted session state.
SqlServices.InstallSessionState(server, user, password,
    null, SessionStateType.Persisted);
' Install persisted session state.
SqlServices.InstallSessionState(server, user, password, _
    Nothing, SessionStateType.Persisted)

Remarks

If server is null or not supplied, SqlServices will use the default SQL Server instance.

Note

The connection to the database server is made with a trusted connection.

See also

Applies to