473,508 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CustomErrorPage

Seb
Hello All,

Trying the first time to use a custom ErrorPage
using:
<customErrors
mode="On"
defaultRedirect="TR_Error.aspx"
/>
in the Web.config

Somehow the Application never reaches this page!
(I still see the ASP-Default-ErrorPage)

What might be wrong here?

Has anyone got a ErrorPage-Example?

Nov 17 '05 #1
1 1110
HERE YOU go with one custom error page with mail
functionality
<customErrors mode="Off" defaultRedirect="err.aspx">
<error statusCode="500" redirect="err.aspx"/>
<error statusCode="404" redirect="err.aspx"/>
<error statusCode="403" redirect="err.aspx"/>
</customErrors>

Imports System.Web.Mail
Public Class Error_Page
Inherits System.Web.UI.Page
Protected WithEvents btSend As
System.Web.UI.WebControls.Button
Protected WithEvents Label5 As
System.Web.UI.WebControls.Label
Protected WithEvents Label4 As
System.Web.UI.WebControls.Label
Protected WithEvents Label3 As
System.Web.UI.WebControls.Label
Protected WithEvents Label2 As
System.Web.UI.WebControls.Label
Protected WithEvents HyperLink1 As
System.Web.UI.WebControls.HyperLink
Protected WithEvents tbWhat As
System.Web.UI.WebControls.TextBox
Protected WithEvents tbWhen As
System.Web.UI.WebControls.TextBox
Protected WithEvents tbFrom As
System.Web.UI.WebControls.TextBox
Protected WithEvents tbMessage As
System.Web.UI.WebControls.Label
Protected WithEvents Label1 As
System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web
Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
tbWhen.Text = Now.ToString
If Not Cache("UserName") Is Nothing Then
tbFrom.Text = CType(Cache("UserName"), String)
End If
End Sub

Private Sub btSend_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btSend.Click
Dim mail As New MailMessage()
With mail
.From = ""
.To = ""
.Subject = "Error at soltn"
.Body = "When : " & tbWhen.Text & "<br>"
.Body = .Body + "What : " & tbWhat.Text
& "<br>"
.Body = .Body + "From : " & tbFrom.Text
& "<br>"
.BodyFormat = MailFormat.Html
End With
SmtpMail.SmtpServer = ""
SmtpMail.Send(mail)
tbMessage.Visible = True
End Sub

End Class
-----Original Message-----
Hello All,

Trying the first time to use a custom ErrorPage
using:
<customErrors
mode="On"
defaultRedirect="TR_Error.aspx"
/>
in the Web.config

Somehow the Application never reaches this page!
(I still see the ASP-Default-ErrorPage)

What might be wrong here?

Has anyone got a ErrorPage-Example?

.

Nov 17 '05 #2

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

Similar topics

1
980
by: Seb | last post by:
Hello all, I have tried to set my ErrorPage everywhere: in Web.config, in the Page as well as in the class behind the page. I just don't reach it! (always see the default asp- errorpage)....
21
2678
by: Gary | last post by:
When using an ASPX page for a DefaultRedirect it does not work if the ASPX page has any code in it. If I put ... If Not IsPostBack Then lblMessage.Text = Server.GetLastError.Message End If ...
2
1609
by: Marty McDonald | last post by:
Many of our apps are in production and they do not have proper error logging in them - unhandled errors are seen by the users in the form of error messages and stack traces. I know how to make...
3
1489
by: Girish | last post by:
so I was looking at an example on codeproject.com that talked about how to globalize your error handling. I was extremely confused by some code. Id appreciate if someone could help me out by...
1
2409
by: robertlair | last post by:
I am having issues with a production server with the GetLastError() method. Here is what I am doing: Application_Error on Global ASAX: Note: I am doing it this way (with ClearError) because...
5
17424
by: Pavils Jurjans | last post by:
Hello, Is there any way I can intercept the session timeout exception, and 1) Run some code routine, ie log the error and it's context 2) Show nicer output to the user Please do not suggest...
1
1401
by: David C | last post by:
I am trying to email a GridView saved as html but all I am getting is "System.Web.UI.HtmlTextWriter" in the Body of the email. Below is my code. Any help is appreciated. -David Protected Sub...
0
7225
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
7326
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,...
0
7385
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...
1
7046
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...
0
7498
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...
0
5629
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 project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.