Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   When is impersonation 'on'? (

Brian 05-14-2008 02:22 PM

When is impersonation 'on'?

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

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

I tried overriding Init() in the HttpModule but no impersonation.

I can't use Session_Start() because I'm not using session state at

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!


All times are GMT. The time now is 10:12 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.