Ask a Question related to ASP.NET Security, Design and Development.
-
Larry #1
Eventlog application registration error
As I understand it from the examples in the documentation each application
needs to get registered in order to be able to write to an event log.
I tried to follow the example but when I run my asp.net code I get a
security error. The implication is that the work process account doesn't
have the correct permissions to execute the createEventSource.
Here's the code fragment that's causing the error:
Dim source As String = "Report Request Confirmation"
Dim log As String = "HCS Log"
If (Not EventLog.SourceExists(source)) Then
EventLog.CreateEventSource(source, log)
End If
How do I get around this?
-Larry
Larry Guest
-
self registration error
when running setup thru cd drive for program installation, receive self registration error/windows/system32/macromed/flash.ocx. -
Eventlog problems
Hi All, I'm writing an webservice and want to log errors etc. and thoughed the Eventlog would be a nice place for it. The problem is that i can't... -
EventLog access through ASP.Net app
I have an ASP.Net app for which I want to be able to log events to the Windows 2000 server event log under a special log name. I encountered the... -
[ANN] win32-eventlog 0.1.0
Hi all, I'm happy to announce the first release of win32-eventlog. This is a Ruby interface to the Win32 EventLog. Synopsis ========... -
Registration related error
Hi Im looking to find out which file holds the information for product registration, the reason for this request is I am trying out hisecwk.inf, a... -
Steven Cheng[MSFT] #2
RE: Eventlog application registration error
Hi Larry,
From your description, you encountered security permission issue when try
accessing the EventLog( create a new event source ) in ASP.NET web
application, yes?
What about the detailed exception info it popup? I'm not sure whether
you've read the following kb article, it have discussed a existing problem
when you try accessing the EventLog in ASP.NET by default process
acount(ASPNET) and provide a complete steps on creating a new event source:
#PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET
Application Tries to Write New EventSource in the EventLog
[url]http://support.microsoft.com/?id=329291[/url]
Please have a look to see whether it helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
[url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
Steven Cheng[MSFT] Guest
-
Larry #3
Re: Eventlog application registration error
Your suggestion hasn't quite worked. Using the information you supplied did
allow me to create a new event log (and I assume the associated sources I
wanted) BUT I still can NOT get my web application to write any entries into
the log. Hopefully the following will aid you in coming up with some ideas
what to try next, as I have very little idea what permissions, and where I
need to change to make this work; or just what I could do to get it working.
here's my code to generate the entries:
----------------------------------------------------------------------------
-------
Private Sub write2log(ByVal logText As String, ByVal eventlogtype As Int16)
Dim source As String = "Development Web site" ' use this source for
development
' dim source as string = "NoiseShield/shades site" ' use this source for
production
Dim log As String = "HCS Programs"
If (Not EventLog.SourceExists(source)) Then
Me.errMessage.Text = "Event log source does not exist!"
End If
Dim aLog As EventLog
Dim EntryType As EventLogEntryType
Select Case eventlogtype
Case critical
EntryType = EventLogEntryType.Error
Case warning
EntryType = EventLogEntryType.Warning
Case informational
EntryType = EventLogEntryType.Information
End Select
aLog = New EventLog
aLog.Source = source
aLog.WriteEntry(logText, EntryType) ' <-----this is line 106 that causes
the error
End Sub
----------------------------------------------------------------------------
------------------------------------------------
and here's the trace from the error page:
----------------------------------------------------------------------------
---------------------------------------------------
Stack Trace:
[SecurityException: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
+473
System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName, String machineName, Boolean useMutex) +445
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData) +342
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category) +21
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID) +15
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type) +11
autoresponder.ReportRequestConfirmation.write2log( String logText, Int16
eventlogtype) in C:\Documents and
Settings\lbilodeau.OROFFICE\VSWebCache\development .froghaven.com\HCS_IT\nois
eshield\autoresponder\reportRequestConformation.as px.vb:106
"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:d7lNF9sHEHA.612@cpmsftngxa06.phx.gbl...source:> Hi Larry,
>
> From your description, you encountered security permission issue when try
> accessing the EventLog( create a new event source ) in ASP.NET web
> application, yes?
>
> What about the detailed exception info it popup? I'm not sure whether
> you've read the following kb article, it have discussed a existing problem
> when you try accessing the EventLog in ASP.NET by default process
> acount(ASPNET) and provide a complete steps on creating a new eventASP.NET>
> #PRB: "Requested Registry Access Is Not Allowed" Error Message When> Application Tries to Write New EventSource in the EventLog
> [url]http://support.microsoft.com/?id=329291[/url]
>
> Please have a look to see whether it helps. Thanks.
>
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! [url]www.microsoft.com/security[/url]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
>
Larry Guest
-
Larry #4
Re: Eventlog application registration error
Never mind. actually your solution did work. My error was to try to register
two sources in my installation program by simply changing the source value.
For anyone else that is following this the following does not work as
intended, only the last source gets registered properly:
Imports System.Diagnostics
Imports System.Configuration.Install
Imports System.ComponentModel
<RunInstaller(True)> Public Class HCSEventLogInstaller
Inherits Installer
Private HCSEventLogInstaller As EventLogInstaller
Public Sub New()
HCSEventLogInstaller = New EventLogInstaller
' set the source of the event log to be created
HCSEventLogInstaller.Source = "Development Web site"
' set the log that the source is created in
HCSEventLogInstaller.Log = "HCS Programs"
'add this event source to the collection
Installers.Add(HCSEventLogInstaller)
' set the alternate source
HCSEventLogInstaller.Source = "NoiseShield/shades site"
Installers.Add(HCSEventLogInstaller)
End Sub
End Class
As to how to get two sources registered in on go, I haven't a clue at this
time.
-Larry
"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:d7lNF9sHEHA.612@cpmsftngxa06.phx.gbl...source:> Hi Larry,
>
> From your description, you encountered security permission issue when try
> accessing the EventLog( create a new event source ) in ASP.NET web
> application, yes?
>
> What about the detailed exception info it popup? I'm not sure whether
> you've read the following kb article, it have discussed a existing problem
> when you try accessing the EventLog in ASP.NET by default process
> acount(ASPNET) and provide a complete steps on creating a new eventASP.NET>
> #PRB: "Requested Registry Access Is Not Allowed" Error Message When> Application Tries to Write New EventSource in the EventLog
> [url]http://support.microsoft.com/?id=329291[/url]
>
> Please have a look to see whether it helps. Thanks.
>
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! [url]www.microsoft.com/security[/url]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
>
Larry Guest
-
Joe Kaplan \(MVP - ADSI\) #5
Re: Eventlog application registration error
Take out the EventLog.SourceExists call. That is causing the security
exception.
Just write to the log and it should be fine. If you need to, you can put
that part in a try/catch block in case the write fails for some reason.
Joe K.
"Larry" <Larry@froghaven.com> wrote in message
news:ejK7aM2HEHA.1548@TK2MSFTNGP10.phx.gbl...did> Your suggestion hasn't quite worked. Using the information you suppliedinto> allow me to create a new event log (and I assume the associated sources I
> wanted) BUT I still can NOT get my web application to write any entriesworking.> the log. Hopefully the following will aid you in coming up with some ideas
> what to try next, as I have very little idea what permissions, and where I
> need to change to make this work; or just what I could do to get it-->
> here's my code to generate the entries:
> --------------------------------------------------------------------------Int16)> -------
> Private Sub write2log(ByVal logText As String, ByVal eventlogtype Ascauses>
> Dim source As String = "Development Web site" ' use this source for
> development
>
> ' dim source as string = "NoiseShield/shades site" ' use this source for
> production
>
> Dim log As String = "HCS Programs"
>
> If (Not EventLog.SourceExists(source)) Then
>
> Me.errMessage.Text = "Event log source does not exist!"
>
> End If
>
> Dim aLog As EventLog
>
> Dim EntryType As EventLogEntryType
>
> Select Case eventlogtype
>
> Case critical
>
> EntryType = EventLogEntryType.Error
>
> Case warning
>
> EntryType = EventLogEntryType.Warning
>
> Case informational
>
> EntryType = EventLogEntryType.Information
>
> End Select
>
> aLog = New EventLog
>
> aLog.Source = source
>
> aLog.WriteEntry(logText, EntryType) ' <-----this is line 106 that--> the error
>
> End Sub
>
> ----------------------------------------------------------------------------> ------------------------------------------------
>
> and here's the trace from the error page:
>
> --------------------------------------------------------------------------EventLogEntryType> ---------------------------------------------------
>
> Stack Trace:
>
> [SecurityException: Requested registry access is not allowed.]
> Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
> +473
> System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
> logName, String machineName, Boolean useMutex) +445
> System.Diagnostics.EventLog.WriteEntry(String message,EventLogEntryType> type, Int32 eventID, Int16 category, Byte[] rawData) +342
> System.Diagnostics.EventLog.WriteEntry(String message,EventLogEntryType> type, Int32 eventID, Int16 category) +21
> System.Diagnostics.EventLog.WriteEntry(String message,EventLogEntryType> type, Int32 eventID) +15
> System.Diagnostics.EventLog.WriteEntry(String message,Settings\lbilodeau.OROFFICE\VSWebCache\development .froghaven.com\HCS_IT\nois> type) +11
> autoresponder.ReportRequestConfirmation.write2log( String logText, Int16
> eventlogtype) in C:\Documents and
>try> eshield\autoresponder\reportRequestConformation.as px.vb:106
>
>
>
>
>
> "Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
> news:d7lNF9sHEHA.612@cpmsftngxa06.phx.gbl...> > Hi Larry,
> >
> > From your description, you encountered security permission issue whenproblem> > accessing the EventLog( create a new event source ) in ASP.NET web
> > application, yes?
> >
> > What about the detailed exception info it popup? I'm not sure whether
> > you've read the following kb article, it have discussed a existing> source:> > when you try accessing the EventLog in ASP.NET by default process
> > acount(ASPNET) and provide a complete steps on creating a new event> ASP.NET> >
> > #PRB: "Requested Registry Access Is Not Allowed" Error Message When>> > Application Tries to Write New EventSource in the EventLog
> > [url]http://support.microsoft.com/?id=329291[/url]
> >
> > Please have a look to see whether it helps. Thanks.
> >
> >
> > Regards,
> >
> > Steven Cheng
> > Microsoft Online Support
> >
> > Get Secure! [url]www.microsoft.com/security[/url]
> > (This posting is provided "AS IS", with no warranties, and confers no
> > rights.)
> >
> > Get Preview at ASP.NET whidbey
> > [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
> >
>
Joe Kaplan \(MVP - ADSI\) Guest
-
Steven Cheng[MSFT] #6
Re: Eventlog application registration error
Hi Larry,
Have you tried Joe's suggestions or have you resolved the problem, if you
still have any problem or have any new findings, please feel free to post
here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
[url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
Steven Cheng[MSFT] Guest
-
Larry #7
Re: Eventlog application registration error
I resolved the problem by creating a small consule module to create event
sources, so at this point it's working to the client and my satisfaction.
thanks for you guys' help.
-Larry
"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:1NLJQohIEHA.3872@cpmsftngxa06.phx.gbl...> Hi Larry,
>
> Have you tried Joe's suggestions or have you resolved the problem, if you
> still have any problem or have any new findings, please feel free to post
> here. Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! [url]www.microsoft.com/security[/url]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]
>
>
Larry Guest



Reply With Quote

