When is impersonation 'on'?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top