473,662 Members | 2,760 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 1118
HERE YOU go with one custom error page with mail
functionality
<customErrors mode="Off" defaultRedirect ="err.aspx">
<error statusCode="500 " redirect="err.a spx"/>
<error statusCode="404 " redirect="err.a spx"/>
<error statusCode="403 " redirect="err.a spx"/>
</customErrors>

Imports System.Web.Mail
Public Class Error_Page
Inherits System.Web.UI.P age
Protected WithEvents btSend As
System.Web.UI.W ebControls.Butt on
Protected WithEvents Label5 As
System.Web.UI.W ebControls.Labe l
Protected WithEvents Label4 As
System.Web.UI.W ebControls.Labe l
Protected WithEvents Label3 As
System.Web.UI.W ebControls.Labe l
Protected WithEvents Label2 As
System.Web.UI.W ebControls.Labe l
Protected WithEvents HyperLink1 As
System.Web.UI.W ebControls.Hype rLink
Protected WithEvents tbWhat As
System.Web.UI.W ebControls.Text Box
Protected WithEvents tbWhen As
System.Web.UI.W ebControls.Text Box
Protected WithEvents tbFrom As
System.Web.UI.W ebControls.Text Box
Protected WithEvents tbMessage As
System.Web.UI.W ebControls.Labe l
Protected WithEvents Label1 As
System.Web.UI.W ebControls.Labe l

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()

End Sub

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

#End Region

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

Private Sub btSend_Click(By Val sender As
System.Object, ByVal e As System.EventArg s) 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.SmtpSe rver = ""
SmtpMail.Send(m ail)
tbMessage.Visib le = 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
983
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). What do I do wrong? What have I forgotten? Where could I have a setting with higher priority?
21
2706
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 in the ASPX page it does not display when an unhandled exception is thrown.
2
1611
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 apps handle their errors (global.asax.cs "application_error" event, web.config "customErrors" section, etc). But can I do this without having to visit each app? Can this be done at the machine level? I'm looking for a kind of machine-level...
3
1493
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 understanding this. URL if anyone is interested: http://www.codeproject.com/aspnet/JcGlobalErrorHandling.asp#xx726891xx 1) Ok, so in short, the way to do this error handling is to set a STATIC variable in some class whenever an error occurs....
1
2427
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 while researching, someone on a post said that Session state would not persist unless I cleared the error... didn't make sense, but it also didn't work before I put this in there too.
5
17454
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 to increase the session timeout value, or write a code that doesn't loop. No fools here. There are possible contexts where I want to keep the session timeout reasonably low, but need to log the occasions, when it's hit, to rearchitecture those...
1
1407
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 BtnEmailPlanner_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim gv As GridView = gvWeeklyPlanner Dim SB As New StringBuilder() Dim SW As New StringWriter(SB)
0
8435
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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
8768
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...
0
7368
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, and deployment—without 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...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
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
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.