Create New EventLog

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

    #1

    Create New EventLog

    Hi NG
    I try to create a new EventSource in an asp.net projetct with the following
    code but I always get the error
    Registry access nod allowed...
    I changed the userName in the processModell of my machine.config file to
    SYSTEM.
    What else do I have to do?
    try
    {
    if (!System.Diagno stics.EventLog. SourceExists(ap plicationName))
    {
    System.Diagnost ics.EventLog.Cr eateEventSource (applicationNam e, "ESHOP");
    }
    }
    catch(System.Se curity.Security Exception e)
    {
    throw new System.Security .SecurityExcept ion(e.Message);
    }

    tnx

    stefan


  • Greg Ewing [MVP]

    #2
    Re: Create New EventLog

    Stefan, You can do a couple of things,

    1. Change the access that the aspnet user has on your web server so that it
    is allowed access to the event log.
    2. Change the user under which ASP.Net runs.
    3. Use impersonation for that section of code to impersonate a privileged
    use while running within the ASP.Net process.

    --
    Greg Ewing [MVP]



    "Stefan" <shogun@steffsw orld.ch> wrote in message
    news:O5MVsQWjDH A.2536@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi NG
    > I try to create a new EventSource in an asp.net projetct with the[/color]
    following[color=blue]
    > code but I always get the error
    > Registry access nod allowed...
    > I changed the userName in the processModell of my machine.config file to
    > SYSTEM.
    > What else do I have to do?
    > try
    > {
    > if (!System.Diagno stics.EventLog. SourceExists(ap plicationName))
    > {
    > System.Diagnost ics.EventLog.Cr eateEventSource (applicationNam e, "ESHOP");
    > }
    > }
    > catch(System.Se curity.Security Exception e)
    > {
    > throw new System.Security .SecurityExcept ion(e.Message);
    > }
    >
    > tnx
    >
    > stefan
    >
    >[/color]


    Comment

    Working...