Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 15th, 2004, 01:23 PM
Registered User
 
Join Date: Sep 2003
Location: Dallas, TX, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to saleyoun@hotmail.com Send a message via MSN to saleyoun@hotmail.com Send a message via Yahoo to saleyoun@hotmail.com
Default Application_Error in global.asax

In th Professional ASP.NET 1.0 book there is an example of the Application_Error event in the global.asax.

I wrote this


    Public Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when an error occurs
        Dim LogName As String = "Web_Errors"
        Dim Message As String

        Message = "Url: " & Request.Path
        Message = Message + " Error: " & Server.GetLastError.ToString

        If (Not EventLog.SourceExists(LogName)) Then
            EventLog.CreateEventSource(LogName, LogName)
        End If

        Dim Log As New EventLog

        Log.Source = LogName
        Log.WriteEntry(Message, EventLogEntryType.Error)
    End Sub

and modified the code on the default.aspx page so it will have an error. I run the application, get the error on the screen but no log file is created. Am I doing something wrong? or I need to modify the permissions of the asp.net user?

  #2 (permalink)  
Old April 15th, 2004, 01:32 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

This is indeed a permissions issue. Earlier versions of ASP.NET allowed for LogSources to be created at run-time but that's not possible anymore. One way to fix this, is to give the ASPNET account the rights to the required registry keys.

However, it's recommended to create the required logs and sources at design / deployment time, and just write to them at run-time.

Check out these two threads for more background info:

http://p2p.wrox.com/topic.asp?TOPIC_ID=3095
http://p2p.wrox.com/topic.asp?TOPIC_ID=251

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: My Morning Song by The Black Crowes (Track 9 from the album: The Southern Harmony And Musical Companion)

  #3 (permalink)  
Old April 15th, 2004, 03:00 PM
Registered User
 
Join Date: Sep 2003
Location: Dallas, TX, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to saleyoun@hotmail.com Send a message via MSN to saleyoun@hotmail.com Send a message via Yahoo to saleyoun@hotmail.com
Default

I found a link to the Exception Management Application Block. I'm going to give this a try. Thanks for your help.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
Error with Global.asax madkaikar_ashish .NET Web Services 3 August 7th, 2006 12:03 AM
what is global.asax? gaurav_jain2403 General .NET 1 February 3rd, 2006 02:40 PM
global.asax ashokparchuri ADO.NET 1 February 25th, 2005 08:40 AM



All times are GMT -4. The time now is 05:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.