« Previous Next »

Thread: Urgent: Can not impersonate for MSutil with ASP.NET

Last post 11-17-2009 10:37 PM by joelangley. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 11-09-2009, 3:46 AM

    • tuantomy
    • Not Ranked
    • Joined on 09-03-2008, 7:53 AM
    • Posts 4

    Urgent: Can not impersonate for MSutil with ASP.NET

    I created a website using ASP.NET and imported MSUtil as a reference. MSUtil.Interop  was installes into GAC.

    Then I create a code like this:

    LogQueryClassClass logQuery = new LogQueryClassClass();

    COMEventLogInputContextClassClass evtLog = new COMEventLogInputContextClassClass();

    ILogRecordset iLogRecordSet = logQuery.Execute("SELECT top 10 FROM \\abc\security", evtLog);

    ---------------

    I publish this web application on IIS local, identity of this website is a domain account but this account did not belong to Local Admin Group.

    I rewrite the code using:

    using(Impersonate imp = new Impersonate("account_A","domain","pass"))

    {

    ///My code here

    }

    account_A is a domain account with full rights on that computer and belongs to Local Admin Group.

     But I still get an error, I mean I could not impersonate my code to admin account when I run the application with non-local admin account as identity.

    Please help me fix that.

    Thanks

  • 11-17-2009, 10:37 PM In reply to

    Re: Urgent: Can not impersonate for MSutil with ASP.NET

    It is hard to see without seeing your code 100%, but in the past I have had trouble using Logparser to read an event viewer on a different domain...even when attempting impersonation. My solution was to do pass-through authentication. Although not the best solution, it does work and will allow you to parse a log on a different domain.

    Check out my blog for other cool tips and tricks:

    http://joelangley.blogspot.com/
Page 1 of 1 (2 items)
Microsoft Communities