What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 8333 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > Problem Redirecting to the Custom Error Page ...
Vuyiswamb

Problem Redirecting to the Custom Error Page

Replies: 5 | Posted by: Vuyiswamb on 5/16/2012 | Category: ASP.NET Forums | Views: 776 | Status: [Member] [MVP] [Administrator] | Points: 10  


Good Day ALL

I have tried something and i am not sure what is the problem.

i have inherited the an asp.net app. So i want to add the custom Error Handling. I know there are two methods i can do this.

1) Web Config

2)Global.asa

So i started with the web config just to see how it will look and i accessed the page that normally gives an Exception. so basically i have a page gives a


500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.


So now , if there is an Error i want it to go to that Error Page. In the web config i have the Following

<customErrors defaultRedirect="content/ErrorPages/SupportError.aspx" mode="On">

<error statusCode="404" redirect="content/ErrorPages/SupportError.aspx" />
<error statusCode="400" redirect="content/ErrorPages/SupportError.aspx" />
<error statusCode="500" redirect="content/ErrorPages/SupportError.aspx" />
</customErrors>


This means that when this kind of Errors occur it should redirect to that page. All these pages are contents of the Master page including the Error page. But this Error Persist it does not show me the Error page. Even if i try to see if it goes to "Application_Error" in the Global.asa nothing goes there.

So i have also tried the second option. so i turned the web config part
"off" and i trapped this in the global.asa like this


 Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

Server.Transfer("~/Content/ErrorPages/SupportError.aspx")

'Response.Redirect("~/Content/ErrorPages/SupportError.aspx", False)
End Sub


but still nothing happens

THanks

Thank you for posting at Dotnetfunda
[Administrator]


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Akiii
Akiii  
Posted on: 5/16/2012 5:35:25 AM
Level: Bronze | Status: [Member] | Points: 25

Sir, I am using the custom error handling block in web.config file and it is working fine. I think this is the best method to handle the errors others its not a good solution to write error handling code in each and every page.

Have you tested in localhost ?
Is it showing the same problem in the localhost ?


Thanks and Regards
Akiii

Vuyiswamb, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vuyiswamb
Vuyiswamb  
Posted on: 5/16/2012 5:50:26 AM
Level: NotApplicable | Status: [Member] [MVP] [Administrator] | Points: 25

hi Akiii

Sometimes you would like to send an email and get the Error that was produced ,so the global.asa option is good for that as i said i tried both of them but i failed miserably.

Thanks


Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Akiii
Akiii  
Posted on: 5/16/2012 5:52:55 AM
Level: Bronze | Status: [Member] | Points: 25

What error code is thrown when an application error is encountered in the global.asax file ?


Thanks and regards
Akiii

Vuyiswamb, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vuyiswamb
Vuyiswamb  
Posted on: 5/16/2012 6:11:29 AM
Level: NotApplicable | Status: [Member] [MVP] [Administrator] | Points: 25

hi Akiii

i dont get an Error , The problem is that if there is a 500 Exception, the Error Page does not Appear .

Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Akiii
Akiii  
Posted on: 5/16/2012 6:39:05 AM
Level: Bronze | Status: [Member] | Points: 25

Its a strange situation. I have encountered a page while i was reading, please go through it :-

http://www.checkupdown.com/status/E500.html



Regards
Akiii

Vuyiswamb, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/24/2013 9:44:50 PM