IIS Impersonate not taking place till after Application_Start event

M

MattC

Hi,

In IIS I have anonymous access set to true and I have a user specifed for
IIS to use (MyAppUser). This user has access to my database.

I retrieve configuration data for my application when the app starts, I
placed my code in the Application_Start event method.

My connection string is (value="server=localhost; database=MyDB;
Trusted_Connection=true" ) and <identity impersonate="true" /> so IIS will
use MyAppUser as the account to try and conenct to the DB as. This works
fine if my code is placed in a Page but when I placed it in
Application_Start it trys to log on as ASPNET user.

Is this becasue the impersonation only takes effect once the Application has
started??

Some advice would be handy about now :)

Thanks in advance

MattC
 
R

Raterus

I can't say I really know any more about this than you do, but it would seem to me that this would be the default behavior for application level events. The application has to be started before the user can start his stuff, not the other way around.

What you could try is impersonating via code, using this,
http://support.microsoft.com/default.aspx?scid=kb;en-us;306158
don't think the first option will work, but you certainly should be able to use the second method, but you'll have to supply the username/password.

Or you can move this from the application_start to session_start?

--Michael
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top