471,119 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

ASP.NET App Writing to Event Log on Server

orp
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
getting the ASP.NET app. to write to the event log when accessing the web
site from a separate client computer.

Here's some details:

Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the Users group on the
client computer
The local user on the client is also defined as a local user on the server
with same name and password (and only in the Users group on the server too)
Server is Windows Server 2003 running IIS 6.0
Client is Windows XP Professional
ASP.NET 2.0 (C#) web site - intranet only, not a public Internet web site
Web.config snippet
<system.web>
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>

..aspx code-behind code snippet
string exceptionInfo = "Testing WriteToEventLog";
System.Diagnostics.EventLog log = new System.Diagnostics.EventLog();
log.Log = "Application";
log.Source = "Application";

try
{
// EXCEPTION happens here
log.WriteEntry(exceptionInfo,
System.Diagnostics.EventLogEntryType.Error);
}
finally
{
log.Close();
log.Dispose();
}
The exception details are: System.ComponentModel.Win32Exception: Access is
denied (Cannot open log for source 'Application'. You may not have write
access.)

From the client computer, I can navigate to the site and do whatever without
any problems. But, when the site tries to write to the event log on the
server for the session started by the client in the scenario described
above, it fails.

Basically, this is supposed to be an exception notification thing.
What's wrong? Am I missing something? How can I make the above scenario
work?
Thanks.

May 5 '06 #1
2 1652
What account is your ASP.Net app running under? It is that account that
doesn't have permission.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"orp" <no****@company.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
getting the ASP.NET app. to write to the event log when accessing the web
site from a separate client computer.

Here's some details:

Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the Users group on the
client computer
The local user on the client is also defined as a local user on the server
with same name and password (and only in the Users group on the server
too)
Server is Windows Server 2003 running IIS 6.0
Client is Windows XP Professional
ASP.NET 2.0 (C#) web site - intranet only, not a public Internet web site
Web.config snippet
<system.web>
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>

.aspx code-behind code snippet
string exceptionInfo = "Testing WriteToEventLog";
System.Diagnostics.EventLog log = new
System.Diagnostics.EventLog();
log.Log = "Application";
log.Source = "Application";

try
{
// EXCEPTION happens here
log.WriteEntry(exceptionInfo,
System.Diagnostics.EventLogEntryType.Error);
}
finally
{
log.Close();
log.Dispose();
}
The exception details are: System.ComponentModel.Win32Exception: Access is
denied (Cannot open log for source 'Application'. You may not have write
access.)

From the client computer, I can navigate to the site and do whatever
without
any problems. But, when the site tries to write to the event log on the
server for the session started by the client in the scenario described
above, it fails.

Basically, this is supposed to be an exception notification thing.
What's wrong? Am I missing something? How can I make the above scenario
work?
Thanks.

May 5 '06 #2
orp
Thanks. I'm not sure what account my ASP.NET app is running under. How can
I tell?

I can tell you this, however. It works fine if I log into the client as a
user in the client's local Administrators group (the user is also in the
Administrators group on the server).
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uy**************@TK2MSFTNGP02.phx.gbl...
What account is your ASP.Net app running under? It is that account that
doesn't have permission.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"orp" <no****@company.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles getting the ASP.NET app. to write to the event log when accessing the web site from a separate client computer.

Here's some details:

Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the Users group on the client computer
The local user on the client is also defined as a local user on the server with same name and password (and only in the Users group on the server
too)
Server is Windows Server 2003 running IIS 6.0
Client is Windows XP Professional
ASP.NET 2.0 (C#) web site - intranet only, not a public Internet web site

Web.config snippet
<system.web>
<authentication mode="Windows"/>
<identity impersonate="true"/>
</system.web>

.aspx code-behind code snippet
string exceptionInfo = "Testing WriteToEventLog";
System.Diagnostics.EventLog log = new
System.Diagnostics.EventLog();
log.Log = "Application";
log.Source = "Application";

try
{
// EXCEPTION happens here
log.WriteEntry(exceptionInfo,
System.Diagnostics.EventLogEntryType.Error);
}
finally
{
log.Close();
log.Dispose();
}
The exception details are: System.ComponentModel.Win32Exception: Access is denied (Cannot open log for source 'Application'. You may not have write access.)

From the client computer, I can navigate to the site and do whatever
without
any problems. But, when the site tries to write to the event log on the
server for the session started by the client in the scenario described
above, it fails.

Basically, this is supposed to be an exception notification thing.
What's wrong? Am I missing something? How can I make the above scenario work?
Thanks.


May 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Ollie | last post: by
6 posts views Thread by MattC | last post: by
2 posts views Thread by MattB | last post: by
3 posts views Thread by Peter Bradley | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.