IIS Impersonate not taking place till after Application_Start event

Discussion in 'ASP .Net' started by MattC, Aug 6, 2004.

  1. MattC

    MattC Guest

    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
    MattC, Aug 6, 2004
    #1
    1. Advertising

  2. MattC

    Raterus Guest

    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

    "MattC" <> wrote in message news:%...
    > 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
    >
    >
    Raterus, Aug 6, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    1
    Views:
    745
  2. Bill Belliveau

    DirectoryEntry Impersonate or WindowsIdentity Impersonate?

    Bill Belliveau, Jan 28, 2004, in forum: ASP .Net Security
    Replies:
    3
    Views:
    339
    Joe Kaplan \(MVP - ADSI\)
    Jan 31, 2004
  3. Morten Overgaard

    Application_Start event does not fire on restart of IIS?

    Morten Overgaard, Aug 25, 2003, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    472
    Lewis Wang [MSFT]
    Aug 26, 2003
  4. Jim Cain
    Replies:
    1
    Views:
    206
    Yukihiro Matsumoto
    Jul 18, 2003
  5. Jaydeep Patil
    Replies:
    0
    Views:
    79
    Jaydeep Patil
    Mar 26, 2014
Loading...

Share This Page