| re: Security policy problem
"Chris Bazalgette" <chris@cbaz.demon.co.uk> wrote in message
news:n9zNUAEbktRBFwgY@cbaz.demon.co.uk...[color=blue]
> I'm in the process of getting to grips with ASP .Net, and have run into
> a problem without an obvious solution. I've added some C# code to write
> errors to the event log, and that compiles fine. But when run, the
> application doesn't have permission to access the registry, and a
> security exception is raised.[/color]
The typical problem is that the ASPNET account doesn't have the privileges
necessary to create a new event source. If you create the event source
first, you should have no trouble writing to it from your web application.
What I usually do, using VS.NET, is to drag an EventLog component onto a
design surface (maybe onto global.asax opened in design mode). I then
configure the event log and source I want. Next, I right-click and choose
"Add Installer". This creates an event log installer capable of installing
that event log.
I then delete the EventLog I dragged onto the design surface!
When built into mywebsite.dll, I can then use "installutil" to "install" the
site:
cd bin
installutil -i mywebsite.dll
When I run these commands as an administrator, the event log source gets
created. Then, when I run my web site, it can create log entries all it
likes.
--
John Saunders
johnwsaundersiii at hotmail |