473,225 Members | 1,313 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,225 software developers and data experts.

Custom Error Handling Problem /Question

I'm testing error handling configurations and having some trouble. I created
a WebForm called. ErrDefault.aspx and I am trying to use the Page error
attribute to force the redirection to a custom page, but I only get and
unhandled exception page and it does not direct me to my specific page. I'm
probably doing something really stupid, but I cant see what .

Any Ideas ? - Thanx Mr N

--------- DETAILS BELOW -----------

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="Exceptions1.WebForm1" errorPage="ErrDefault.aspx"%>
In my button handler.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Throw New System.Net.WebException("Custom Error Page")

End Sub

Custom Error Page
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: Custom Error Page

Source Error:

Line 33:
Line 34: Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
Line 35: Throw New System.Net.WebException("Custom Error Page")
Line 36: End Sub
Line 37: End Class

Nov 19 '05 #1
3 2032
You might want to download and check out the source code for
the "Error Handling in ASP.NET" Code Project article By Rakesh Rajan.

It shows how to manage several error handling configurations.

http://www.codeproject.com/aspnet/Er...lingASPNET.asp

You will need to become a member ( free ) of the Code Project
to be able to download any source code files from it, but they are
good about not hassling you or sending spam.

You can read the article without having to become a member, though.

Off hand :

1. Did you set up error handling in web.config and global.asax ?

web.config :
<customErrors mode="On" defaultRedirect="ErrDefault.aspx"/>

global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Server.Transfer("ErrDefault.aspx")
End Sub

2. What does "ErrDefault.aspx" do ?

I have web.config and global.asax setup that way,
and you can see the test page with your code, working OK, at :

http://asp.net.do/test/errorTest.aspx

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/
======================================
"Mr Newbie" <he**@now.com> wrote in message news:ub*************@TK2MSFTNGP10.phx.gbl...
I'm testing error handling configurations and having some trouble. I created a WebForm
called. ErrDefault.aspx and I am trying to use the Page error attribute to force the
redirection to a custom page, but I only get and unhandled exception page and it does
not direct me to my specific page. I'm probably doing something really stupid, but I
cant see what .

Any Ideas ? - Thanx Mr N

--------- DETAILS BELOW -----------

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="Exceptions1.WebForm1" errorPage="ErrDefault.aspx"%>
In my button handler.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click

Throw New System.Net.WebException("Custom Error Page")

End Sub

Custom Error Page
Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where it
originated in the code.

Exception Details: System.Net.WebException: Custom Error Page

Source Error:

Line 33:
Line 34: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Line 35: Throw New System.Net.WebException("Custom Error Page")
Line 36: End Sub
Line 37: End Class

Nov 19 '05 #2
Thanks Jaun

I'll take a look tomorrow, its late right now and my brain has ceased
virtually all non automatic function.

Regards - Mr N

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You might want to download and check out the source code for
the "Error Handling in ASP.NET" Code Project article By Rakesh Rajan.

It shows how to manage several error handling configurations.

http://www.codeproject.com/aspnet/Er...lingASPNET.asp

You will need to become a member ( free ) of the Code Project
to be able to download any source code files from it, but they are
good about not hassling you or sending spam.

You can read the article without having to become a member, though.

Off hand :

1. Did you set up error handling in web.config and global.asax ?

web.config :
<customErrors mode="On" defaultRedirect="ErrDefault.aspx"/>

global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Server.Transfer("ErrDefault.aspx")
End Sub

2. What does "ErrDefault.aspx" do ?

I have web.config and global.asax setup that way,
and you can see the test page with your code, working OK, at :

http://asp.net.do/test/errorTest.aspx

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/
======================================
"Mr Newbie" <he**@now.com> wrote in message
news:ub*************@TK2MSFTNGP10.phx.gbl...
I'm testing error handling configurations and having some trouble. I
created a WebForm called. ErrDefault.aspx and I am trying to use the
Page error attribute to force the redirection to a custom page, but I
only get and unhandled exception page and it does not direct me to my
specific page. I'm probably doing something really stupid, but I cant see
what .

Any Ideas ? - Thanx Mr N

--------- DETAILS BELOW -----------

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="Exceptions1.WebForm1"
errorPage="ErrDefault.aspx"%>
In my button handler.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Throw New System.Net.WebException("Custom Error Page")

End Sub

Custom Error Page
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: Custom Error Page

Source Error:

Line 33:
Line 34: Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Line 35: Throw New System.Net.WebException("Custom Error Page")
Line 36: End Sub
Line 37: End Class


Nov 19 '05 #3
Yes, that was it, I forgot to set the custom error section in the
web.config, I knew it would be something really stupidly fundamental, and of
course obvious to anyone else but myself.

;-D

Cheers Mr N.
"Mr Newbie" <he**@now.com> wrote in message
news:us*************@TK2MSFTNGP11.phx.gbl...
Thanks Jaun

I'll take a look tomorrow, its late right now and my brain has ceased
virtually all non automatic function.

Regards - Mr N

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
You might want to download and check out the source code for
the "Error Handling in ASP.NET" Code Project article By Rakesh Rajan.

It shows how to manage several error handling configurations.

http://www.codeproject.com/aspnet/Er...lingASPNET.asp

You will need to become a member ( free ) of the Code Project
to be able to download any source code files from it, but they are
good about not hassling you or sending spam.

You can read the article without having to become a member, though.

Off hand :

1. Did you set up error handling in web.config and global.asax ?

web.config :
<customErrors mode="On" defaultRedirect="ErrDefault.aspx"/>

global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Server.Transfer("ErrDefault.aspx")
End Sub

2. What does "ErrDefault.aspx" do ?

I have web.config and global.asax setup that way,
and you can see the test page with your code, working OK, at :

http://asp.net.do/test/errorTest.aspx

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/
======================================
"Mr Newbie" <he**@now.com> wrote in message
news:ub*************@TK2MSFTNGP10.phx.gbl...
I'm testing error handling configurations and having some trouble. I
created a WebForm called. ErrDefault.aspx and I am trying to use the
Page error attribute to force the redirection to a custom page, but I
only get and unhandled exception page and it does not direct me to my
specific page. I'm probably doing something really stupid, but I cant
see what .

Any Ideas ? - Thanx Mr N

--------- DETAILS BELOW -----------

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" Inherits="Exceptions1.WebForm1"
errorPage="ErrDefault.aspx"%>
In my button handler.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Throw New System.Net.WebException("Custom Error Page")

End Sub

Custom Error Page
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.WebException: Custom Error Page

Source Error:

Line 33:
Line 34: Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Line 35: Throw New System.Net.WebException("Custom Error Page")
Line 36: End Sub
Line 37: End Class



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sean Mullaly | last post by:
I have a custom Access menu with sub-menus and sub-sub-menus. (220 items). Right now I have created 220 Functions and attached each individual Function to the specific OnAction property. The...
0
by: Rhys666 | last post by:
OK, an issue I've come across before, but never found a cause for or resolution of, has decided to become the bane of my life again with ASP.Net Custom Error Pages. Basically, my web application...
15
by: bill salkin | last post by:
I'd like to create a custom error handler like this in VB.NET: .... try ... Throw ("Lender Name not in table") .... catch ("Lender Name not in table")
4
by: Paul Wilson | last post by:
I want to use Err.Raise() method to raise my own exceptions. Is this the right way of raising my own exceptions ? (i think this is the only way). What is the Error number i can safely use,...
1
by: serge calderara | last post by:
dear all, i am a bit confused on the way custom error are handling and occurs. First of all I have understand that customer error is used to defined more user friendly message to my end user and...
5
by: jegec | last post by:
Hi all! Brief subject: I have to develop an ASP-based application, and build also a specific error handling ASP. After that I had set the virtual directory Custom Error 500;100 to new ASP -...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

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.