Writing to eventlog from asp.net

  • Thread starter Thread starter Anders Both
  • Start date Start date
A

Anders Both

How can i setup my system so that I can write into the eventLog from the
asp.net process.

I tryid to add the asp.net account to administrator group, but that does not
help.

???
 
I used the advice below to solve this issue

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

It most definetly is because of lack of rights. The ASPNET user on your
machine probably runs as userName="machine" (look for processmodel in
machine.config), which means that it is kept from harming your system.

The easy way to solve this is by setting this attribute to
userName="system". However by doing this the ASPNET user suddenly becomes
god on your machine and makes it vulnerable. Unfortunately I do not know of
a way to give the ASPNET user just enough right to create an event source,
and you're right about the info on the .NET. Everyone takes the easy way and
sets username="system".

Anyway, you can write til the "Application" event log by setting
logname="Application".
 
Hi,

The official way is:
http://support.microsoft.com/?id=329291

Another way (which is not recommended security wise) is to get the
machine.config from c:\<windir>\microsoft.net\framework\<version>\config
directory and change the processModel element to system. (which will get
your process to run in the old asp style (as privileged user).

Thanks,
Joseph Hopkins

Albany Software Ltd
 
Thx for the answers -

Now my only remaining problem is how i make my wery own "custom log", so
that I don´t need to write into the Application Log.

p.s. I don´t need asp.net to make the log. I can just make the new log from
a Windows application, and then write into it from asp.net.

Best Regards
 
Back
Top