Re: global.aspx Application_error does not fire on anything other than



Here's a simple test...

Include this in global.asax :

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Server.Transfer("Errors.aspx")
End Sub

Include this in "errors.aspx" :

errors.aspx:
-------------------
<html>
<script language="VB" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim errMessage As String = ""
Dim appException As System.Exception = Server.GetLastError()
If (TypeOf (appException) Is HttpException) Then
Dim checkException As HttpException = CType(appException, HttpException)
Select Case checkException.GetHttpCode
Case 400
errMessage &= "Bad request. The file size is too large."
Case 401
errMessage &= "You are not authorized to view this page."
Case 403
errMessage &= "You are not allowed to view that page."
Case 404
errMessage &= "The page you have requested can't be found."
Case 408
errMessage &= "The request has timed out."
Case 500
errMessage &= "The server can't fulfill your request."
Case Else
errMessage &= "The server has experienced an error."
End Select
Else
errMessage &= "The following error occurred<BR>" & appException.ToString
End If
ErrorMessage.Text = errMessage & "<BR>We're sorry for the inconvenience."
Server.ClearError()
End Sub
</script>
<body>
<asp:label id="ErrorMessage" font-size="12" font-bold="true" runat=server/>
</body>
</html>
--------------

Finally, inside the system.web section of web.config, include this :

<customErrors mode="On" />

To test, write any invalid URL in the address bar...and see if you get the custom message.
That will tell you whether Global.asax, and Application_Error within it, are firing.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"jvcoach23" <shannonr@xxxxxxxxxxxxxxxxx> wrote in message news:gj73y512ymbu$.3hj258zeujo0.dlg@xxxxxxxxxxxxx
On Tue, 15 Jan 2008 10:11:20 -0600, Shannon wrote:
Well.. i checked the rights according to the article... the user that the
website is running under is ASPNET. that user has the rights that the
article describes... except for this line.. i'm not sure if about it

User profile directory
Used by the GAC cache lock files and the security configuration caching
mechanism of the common language runtime. If the user profile directory for
the account does not exist, ASP.NET uses the default user profile
directory.

i added the user with rigts to the the C:\Documents and Settings\SERVER1
dir (server1/aspnet is the user that shows up when i run the identity page)

so then i uninstalled .net 1.1 and 2.0... uninstalled iis.
reinstalled 1.1 and 2.0. then reinstalled iis

created the application in iis
published the website
had to run aspnet_regiis -i in the 2.0 framework and the website runs, but
the global still is not "working"

what kind of troubleshooting steps can i take to see if the global really
is working but what i'm asking it to do inside the application_error is
bombing, or if the global itself isn't working.

any suggestion would be great
thanks
shannon


.



Relevant Pages

  • Wrapping FileSystemWatcher to prevent crossthread ops
    ... Public Shadows Event Changed(ByVal sender As Object, ... Private Delegate Sub DelegatorFSE(ByVal sender As Object, ... Private Sub watch_Changed(ByVal sender As Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Global.asax not firing
    ... Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ... ' Fires when the application is started ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Global.asax not firing
    ... Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ... ' Fires when the application is started ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: possible to create one control array with different controls?
    ... That's a sub of the base FORM class which is why I surmise you put ... Private Overloads Sub OnEnter(ByVal sender As System.Object, ... If TypeOf sender Is TextBox Then ... I have 3 textboxes and 1 combobox on a form. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Global.asax not firing
    ... Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ... ' Fires when the application is started ...
    (microsoft.public.dotnet.framework.aspnet)