B
Brian
Greetings!
I'm trying to find a good place to call SqlCacheDependency.Start() and
I'm running into some issues. I know this isn't a SQL forum, but this
seems more like an ASP.NET lifetime problem.
I treid Application_Start() but we're running with anon access and
impersonation, and impersonation is not 'on' yet.
I considered impersonating my user in Application_Start() but I'm not
wild about this as I think I'll need the password, etc. I'd rather
keep that out of my app.
I tried overriding Init() in global.asax with the same results as
Application_Start.
I tried Application_BeginRequest() but we've got some HttpModules that
do database access themselves that use cache. IHttpModule.BeginRequest
seems to run BEFORE Application_BeginRequest, so SqlCacheDependency
activity fails. Interestingly, impersonation is ON in
IHttpModule.BeginRequest!
I tried overriding Init() in the HttpModule but no impersonation.
I can't use Session_Start() because I'm not using session state at
all.
So it looks like the only place I can reliably call
SqlCacheDependency.Start() is in the BeginRequest() method of my FIRST
HttpModule, which places it before any DB/cache activity, with
impersonation on. I'd need to use a singleton pattern to ensure it
only happens once.
Am I missing something? Does this make sense? Gives me the willies...
Thanks to all!
-Brain
I'm trying to find a good place to call SqlCacheDependency.Start() and
I'm running into some issues. I know this isn't a SQL forum, but this
seems more like an ASP.NET lifetime problem.
I treid Application_Start() but we're running with anon access and
impersonation, and impersonation is not 'on' yet.
I considered impersonating my user in Application_Start() but I'm not
wild about this as I think I'll need the password, etc. I'd rather
keep that out of my app.
I tried overriding Init() in global.asax with the same results as
Application_Start.
I tried Application_BeginRequest() but we've got some HttpModules that
do database access themselves that use cache. IHttpModule.BeginRequest
seems to run BEFORE Application_BeginRequest, so SqlCacheDependency
activity fails. Interestingly, impersonation is ON in
IHttpModule.BeginRequest!
I tried overriding Init() in the HttpModule but no impersonation.
I can't use Session_Start() because I'm not using session state at
all.
So it looks like the only place I can reliably call
SqlCacheDependency.Start() is in the BeginRequest() method of my FIRST
HttpModule, which places it before any DB/cache activity, with
impersonation on. I'd need to use a singleton pattern to ensure it
only happens once.
Am I missing something? Does this make sense? Gives me the willies...
Thanks to all!
-Brain