473,394 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1737
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Ollie | last post by:
okay sorry for cross posting but want to see if any one can explain the solution to this problem for me: I have a .Net ASP.Net app written in C# that use COM+ components to do some business...
6
by: MattC | last post by:
I have some code that correctly writes to the eventlog on my local machine. I have installed the application on the Live server and all is not well, no event log entries. My development box...
2
by: MattB | last post by:
I'm writing some code to log errors in a web app (vb/asp.net). I found a straightforward-looking example here: http://www.c-sharpcorner.com/Code/2002/May/CustomErrorHandlingASPNEt.asp But mine...
0
by: Tom Wingert | last post by:
Hi, I am having a problem with getting My.Log.WriteException to write to the Event Log in ASP.Net 2.0 with a web service. When an error occurs, My.Log.WriteException doesn't log anything to the...
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
6
by: JeffDotNet | last post by:
Writing to a registered source in the Application event log I have an asp.net framework 2.0 app that I created on a winxp machine and now I am deploying it to IIS6 on a win server2003 machine. ...
3
by: Peter Bradley | last post by:
Hi, I have a Web Service that has been running on a server for a couple of years. I now have to redeploy it to another server. Everything is fine except that the Web Service cannot write to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.