So - after much research, it appears that the < identity impersonate=true > only works AFTER the Application_Start event fires.
Does anyone know any workaround to this problem? I have an application which needs to create the database when the application first starts. The user that the IIS website runs as has the appropriate permissions to do in a way that the APP_POOL user SPECIFICALLY DOES NOT have.
My current HACK solution is to put (peudo code)
static bool AppInitialized = false;
void Session_Start() {
if (!AppInitialized) {
AppInitialized=true;
InitializeApp();
}
}
impersonate=true will be "in effect" by the time a specific session is starting - and so this WORKS, but seems silly since I'm basically re-creating the behavior of the Application_Start event. Seems like there MUST be a more elegant solution to this problem - no?