System.ComponentModel.Win32Exception: Access is denied

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi trying to write to the windows event log with a asp.net web app and am
getting the error
System.ComponentModel.Win32Exception: Access is denied
I am using forms authentication, checking username and password with tables
in a database.
<authentication mode="Forms" />
The event log newlog has already been created, but when I try to clear it I
get the
error.
Dim Eventlog As New System.Diagnostics.EventLog
Eventlog.Log = "newlog"
Eventlog.Source = "newlog"
Eventlog.Clear()
any suggestions?



Paul G
Software engineer.
 
Hi thanks for the response. I was able to get it to work but can only pass a
single string into the writeEntry, as if I try more than 1 parameter I get an
error.
Eventlog.WriteEntry("file login.aspx.v-test123")'works
but
Eventlog.WriteEntry("file login.aspx.v-test123", "test")
creates this error
System.Security.SecurityException: Requested registry access is not allowed
 
try the correct parameter order:

Eventlog.WriteEntry("test","file login.aspx.v-test123")

-- bruce (sqlwork.com)


| Hi thanks for the response. I was able to get it to work but can only
pass a
| single string into the writeEntry, as if I try more than 1 parameter I get
an
| error.
| Eventlog.WriteEntry("file login.aspx.v-test123")'works
| but
| Eventlog.WriteEntry("file login.aspx.v-test123", "test")
| creates this error
| System.Security.SecurityException: Requested registry access is not
allowed
|
|
|
| "Steve C. Orr [MVP, MCSD]" wrote:
|
| > This link may provide you with the solution you seek:
| >
http://dotnet247.com/247reference/a.aspx?u=http://support.microsoft.com/?id=329291
| >
| > --
| > I hope this helps,
| > Steve C. Orr, MCSD, MVP
| > http://SteveOrr.net
| >
| >
| > | > > Hi trying to write to the windows event log with a asp.net web app and
am
| > > getting the error
| > > System.ComponentModel.Win32Exception: Access is denied
| > > I am using forms authentication, checking username and password with
| > > tables
| > > in a database.
| > > <authentication mode="Forms" />
| > > The event log newlog has already been created, but when I try to clear
it
| > > I
| > > get the
| > > error.
| > > Dim Eventlog As New System.Diagnostics.EventLog
| > > Eventlog.Log = "newlog"
| > > Eventlog.Source = "newlog"
| > > Eventlog.Clear()
| > > any suggestions?
| > >
| > >
| > >
| > > Paul G
| > > Software engineer.
| >
| >
| >
 
Hi thanks for the response. Just wondering if there is some automatic way to
clear an event log as I am thinking of starting one on a server for a web
application but do not want it to get too large? I tried writeEvent.Clear()
but get access denied.
 
Back
Top