My environment is Classic ASP. I want to log an event to the Event Log (doesn't really matter which one). I have built a quick test (code below) and keep getting "Permission Denied".
const SUCCESS = 0
const ERROR = 1
const WARNING = 2
const INFORMATION = 4
const AUDIT_SUCCESS = 8
const AUDIT_FAILURE = 16
dim WshShell
set WshShell = Server.CreateObject("WScript.Shell")
wshshell.Logevent WARNING, "Test Event Log by Windows Script Host!"
set wshshell=nothing
Response.write "Event Logged Successfully by Windows Script Host!"
I searched online for a solution to this problem and found some sort of answer. Unfortunately, their solution doesn't work. They say:
Set the following Registry key to 0 instead of 1, and then restart your computer for the changes to take effect. HKLM\System\CurrentControlSet\Services\EventLog\Application Name: RestrictGuestAccess Type: REG_DWORD NOTE: This enables all Guest accounts to write to the Application Event Log.
Is there a better way to do this? Or a real solution, for that matter?
Essentially, I'm trying to log critical errors to some Windows Event Log which will allow for a monitoring system to consume them.
My OS is Windows Server 2003 which uses IIS 6.0.
The actual code will be running on Windows Server 2008 R2 with IIS 7.5.
Does the OS or even the IIS Web Server matter?