Edit

Share via


SqlServices.UninstallSessionState Method

Definition

Removes components for ASP.NET session state from a SQL Server database.

Overloads

UninstallSessionState(String, String, SessionStateType)

Removes components for ASP.NET session state from a SQL Server database.

UninstallSessionState(String, SessionStateType, String)

Removes components for ASP.NET session state from a SQL Server database.

UninstallSessionState(String, String, String, String, SessionStateType)

Removes components for ASP.NET session state from a SQL Server database.

UninstallSessionState(String, String, SessionStateType)

Removes components for ASP.NET session state from a SQL Server database.

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

Parameters

server
String

The SQL Server instance from which to remove the session-state components.

customDatabase
String

The database from which to remove the session-state components.

type
SessionStateType

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

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 UninstallSessionState method of the SqlServices class.

// Remove temporary session state.
SqlServices.UninstallSessionState(server, null,
    SessionStateType.Temporary);
' Remove temporary session state.
SqlServices.UninstallSessionState(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

UninstallSessionState(String, SessionStateType, String)

Removes components for ASP.NET session state from a SQL Server database.

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

Parameters

customDatabase
String

The database from which to remove the session-state components.

type
SessionStateType

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

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 UninstallSessionState(String, String, SessionStateType) method of the SqlServices class.

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

See also

Applies to

UninstallSessionState(String, String, String, String, SessionStateType)

Removes components for ASP.NET session state from a SQL Server database.

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

Parameters

server
String

The SQL Server instance from which to remove 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 from which to remove the session-state components.

type
SessionStateType

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

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 UninstallSessionState(String, String, String, String, SessionStateType) method of the SqlServices class.

// Remove persisted session state.
SqlServices.UninstallSessionState(server, user, password,
    null, SessionStateType.Persisted);
' Remove persisted session state.
SqlServices.UninstallSessionState(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