DisableNotifications Method

SqlCacheDependencyAdmin.DisableNotifications Method

Disables SqlCacheDependency change notifications for the specified database.

Namespace:  System.Web.Caching
Assembly:  System.Web (in System.Web.dll)

public static void DisableNotifications(
	string connectionString


Type: System.String
A connection string used to connect to the SQL Server database.


A connection to the database could not be established.


The security context of the ASP.NET application does not have permission to connect to the database.


The security context of the ASP.NET application does not have permission to disable notifications for the database.

The DisableNotifications method removes support for change notifications from the database specified in the connectionString parameter. Once you have run the DisableNotifications method, you must run the EnableNotifications method if you wish to re-enable change notifications for a database.

The following code example uses the DisableNotifications method to disable change notifications for the database specified by the connection string MyConnectionString.

For the full code required to run the example, see the Example section of the SqlCacheDependencyAdmin class overview topic.

' Create a method to disable SqlCacheDependency
' change notifications for the Northwind database.
Public Sub DisableDatabase_Click( _
 sender As Object, e As System.EventArgs)

   SqlCacheDependencyAdmin.DisableNotifications( _
   Response.Write("Northwind database disabled at " _
   & DateTime.Now.ToString())

   ' An HttpException is thrown if adequate permissions to
   ' modify the database are not granted.

End Sub

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft