473,785 Members | 3,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>
<authenticati on mode="Windows"/>
<identity impersonate="tr ue"/>
</system.web>

..aspx code-behind code snippet
string exceptionInfo = "Testing WriteToEventLog ";
System.Diagnost ics.EventLog log = new System.Diagnost ics.EventLog();
log.Log = "Applicatio n";
log.Source = "Applicatio n";

try
{
// EXCEPTION happens here
log.WriteEntry( exceptionInfo,
System.Diagnost ics.EventLogEnt ryType.Error);
}
finally
{
log.Close();
log.Dispose();
}
The exception details are: System.Componen tModel.Win32Exc eption: 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 1750
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******** ********@TK2MSF TNGP04.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>
<authenticati on mode="Windows"/>
<identity impersonate="tr ue"/>
</system.web>

.aspx code-behind code snippet
string exceptionInfo = "Testing WriteToEventLog ";
System.Diagnost ics.EventLog log = new
System.Diagnost ics.EventLog();
log.Log = "Applicatio n";
log.Source = "Applicatio n";

try
{
// EXCEPTION happens here
log.WriteEntry( exceptionInfo,
System.Diagnost ics.EventLogEnt ryType.Error);
}
finally
{
log.Close();
log.Dispose();
}
The exception details are: System.Componen tModel.Win32Exc eption: 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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:uy******** ******@TK2MSFTN GP02.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******** ********@TK2MSF TNGP04.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>
<authenticati on mode="Windows"/>
<identity impersonate="tr ue"/>
</system.web>

.aspx code-behind code snippet
string exceptionInfo = "Testing WriteToEventLog ";
System.Diagnost ics.EventLog log = new
System.Diagnost ics.EventLog();
log.Log = "Applicatio n";
log.Source = "Applicatio n";

try
{
// EXCEPTION happens here
log.WriteEntry( exceptionInfo,
System.Diagnost ics.EventLogEnt ryType.Error);
}
finally
{
log.Close();
log.Dispose();
}
The exception details are: System.Componen tModel.Win32Exc eption: 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
1625
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 processing...... When I have the ASP.Net website and the COM+ components installed on the same machine (i.e everything local) it all works fine, and it can write to the event log....
6
1712
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 config is as follows: Windows XP Pro running IIS 5.1 Web app using integrated auth using a local user account Account has admin right over machine. Entry has been placed in registry in
2
3215
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 doesn't seem to be working. If I step through the code I put in global.asax.vb it seems to get to the line where it checks for the existence of the log and then returns without writing anything to the event log. I don;t know why or how to...
0
1760
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 Event Log. Played around with it and ended up adding the following listeners to catch and write to the event log by adding the following code in the web.config: <system.diagnostics>
6
2534
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, I'm having trouble writing to the server's event log. Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group on
6
3412
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. This application has to write to the application event log. After deployment of the application I have verified that my source “MySource” exists in the Application event log. I then wrote some text to the event source in a forms app and...
3
2070
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 its log on the new server. As part of the redeployment, I created the event log on the server for the Web service to write to, so I don't understand what the problem can be. I also checked the permissions on the Web service and couldn't find...
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.