Error Reading the Security Log

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom

    Error Reading the Security Log

    I am getting this error when I try and read the events in the Security log.

    A required privilege is not held by the client!

    My web site is set up as Integrated Authentication and in my web.config I
    have the following
    <identity impersonate="tr ue" />

    Since I am an Admin on my box and on the domain, why can't ASP.NET C# code
    read my security log?

    Here is my code:

    EventLog aLog = new EventLog();
    aLog.Entries;
    string sLogName = DDLEventLog.Sel ectedItem.Value .ToString();
    aLog.Log = sLogName;
    aLog.MachineNam e = Environment.Mac hineName;
    LogGrid.DataSou rce = aLog.Entries;
    * LogGrid.DataBin d();

    * is where the error occurs when I try and bind the results from the log to
    a grid.


    Thanks

    Tom
  • David Lloyd

    #2
    Re: Error Reading the Security Log

    Tom:

    If you are running on Windows 2000, the following KB article may be
    relevant.



    --
    David Lloyd
    MCSD .NET


    This response is supplied "as is" without any representations or warranties.


    "Tom" <Tom@discussion s.microsoft.com > wrote in message
    news:A4682C50-7201-4F4A-8076-CF0C11BD85D2@mi crosoft.com...
    I am getting this error when I try and read the events in the Security log.

    A required privilege is not held by the client!

    My web site is set up as Integrated Authentication and in my web.config I
    have the following
    <identity impersonate="tr ue" />

    Since I am an Admin on my box and on the domain, why can't ASP.NET C# code
    read my security log?

    Here is my code:

    EventLog aLog = new EventLog();
    aLog.Entries;
    string sLogName = DDLEventLog.Sel ectedItem.Value .ToString();
    aLog.Log = sLogName;
    aLog.MachineNam e = Environment.Mac hineName;
    LogGrid.DataSou rce = aLog.Entries;
    * LogGrid.DataBin d();

    * is where the error occurs when I try and bind the results from the log to
    a grid.


    Thanks

    Tom


    Comment

    • Willy Denoyette [MVP]

      #3
      Re: Error Reading the Security Log


      "Tom" <Tom@discussion s.microsoft.com > wrote in message
      news:A4682C50-7201-4F4A-8076-CF0C11BD85D2@mi crosoft.com...[color=blue]
      >I am getting this error when I try and read the events in the Security log.
      >
      > A required privilege is not held by the client!
      >
      > My web site is set up as Integrated Authentication and in my web.config I
      > have the following
      > <identity impersonate="tr ue" />
      >
      > Since I am an Admin on my box and on the domain, why can't ASP.NET C# code
      > read my security log?
      >
      > Here is my code:
      >
      > EventLog aLog = new EventLog();
      > aLog.Entries;
      > string sLogName = DDLEventLog.Sel ectedItem.Value .ToString();
      > aLog.Log = sLogName;
      > aLog.MachineNam e = Environment.Mac hineName;
      > LogGrid.DataSou rce = aLog.Entries;
      > * LogGrid.DataBin d();
      >
      > * is where the error occurs when I try and bind the results from the log
      > to
      > a grid.
      >
      >
      > Thanks
      >
      > Tom[/color]

      Make sure you are effectively impersonating an Administrator.

      Willy.



      Comment

      • Willy Denoyette [MVP]

        #4
        Re: Error Reading the Security Log


        "Tom" <Tom@discussion s.microsoft.com > wrote in message
        news:4972DA3F-F527-411C-B657-6A0D578E5797@mi crosoft.com...[color=blue]
        > Willy:
        >
        > Can you elaborate on your comment?
        >
        > What exactly do you mean when you say "Make sure you are effectively
        > impersonating an Administrator"?
        >
        > I'm not sure what to change?
        >
        > Also, I am running under windows 2000 Server.
        >
        > "Willy Denoyette [MVP]" wrote:
        >[/color]

        Did you check the current principal's identity name?

        WindowsPrincipa l wp = new WindowsPrincipa l(WindowsIdenti ty.GetCurrent() );
        String username = wp.Identity.Nam e;

        What happens if you run your code (part of) as administrator from a console
        application?

        Willy.




        Comment

        Working...