0

I have the following web.config setting:

<caching>
  <sqlCacheDependency enabled="true">
    <databases>
      <add name="MyDB" pollTime="5000" connectionStringName="MyConnString"/>
    </databases>
  </sqlCacheDependency>
</caching>

Now, for various reasons, I need to set this in code instead and also replace the connectionStringName with the actual connectionString (there are no connection strings defined in the web.config file).

Using System.Data.SqlClient.SqlDependency.Start(...) in Global.asax is not an option.

Anyone know if this is possible?

peter3
  • 1,074
  • 13
  • 22
  • Possible duplicate of http://stackoverflow.com/questions/3413953/asp-net-sql-cache-dependency-programmatically-configuration – Luke Girvin Jun 21 '11 at 14:41
  • see this link, it may help you http://davidhayden.com/blog/dave/archive/2006/04/29/2929.aspx – Annie Jun 27 '11 at 11:28
  • Can't use SqlDependency.Start in Global.asax, so that solution will not work. – peter3 Jul 24 '11 at 20:20

0 Answers0