Solved

<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> tag

Posted on 2009-01-27
13
40,074 Views
1 Endorsement
Last Modified: 2012-05-06
Hi, I need to know the details of the errors that I get, I put <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
 but when the error appears the page redirects to mycustompage.htm but there is no error details appear, what should I do in mycustompage.htm page to show the details of the error?
1
Comment
Question by:Abdu_Allah
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 250 total points
ID: 23475805
0
 
LVL 12

Assisted Solution

by:CB_Thirumalai
CB_Thirumalai earned 250 total points
ID: 23475815
mycustompage.htm is just a friendly page wherein you can say the user that an error has occurred.  But in order to catch the error and do some processing, you may need to use the Application_Error, which is part of the Global.asax and handle the error.
void Application_Error(object sender, EventArgs e) 
{ 
    // Code that runs when an unhandled error occurs
    // Server.GetLastError() is the entire exception object that you can use.
}

Open in new window

0
 
LVL 6

Expert Comment

by:sankar_ravi
ID: 23475850
Hi
Make sure that, your web.config has this much only i.e., <customErrors mode="RemoteOnly"/>
Results of this is that if you know the scenario to reproduce, you will be able to see the complete error details when you run the app in local web server.  You will never get detailed error when you access remotely with this configuration.

Irrespctive of end user or service provider wants to see the complete error, then use <customError mode="On"/>

In case you don't want your customers to see the errors, then use Page_Error event on all webpages and try to redirect the user to the mycustompage.htm. example:
private void Page_Error(object sender, System.EventArgs e)
{
}
Hope this helps.
Thanks,
Ravi
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 6

Expert Comment

by:sankar_ravi
ID: 23475874
In my above comment, i just forgot one snippet in Page_Error event on all web pages
Page_Error()
{
Exception errEx=Server.GetLastError();
string errmessage= errEx.Message
string stktrace= errEx.StackTrace
Server.ClearError(); // Make sure to clear the error after usage.
}
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 23477863
I guess I should write the error message errmessage before this statement: Server.ClearError();  
right?
 
0
 
LVL 12

Expert Comment

by:CB_Thirumalai
ID: 23478013
You mean display the message in the page, yes
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 23480570
It does not show any error!
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 23480647
CB_Theromalia, how can I display the error message in the customerror.htm file When I use Application_Error event that found in global.asax file?!
0
 
LVL 12

Expert Comment

by:CB_Thirumalai
ID: 23482760
Ok, if you want to show the error, then do a Response.Write(errEx.ToString()); before Server.ClearError();
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 23485404
Do that in global.asax file! this is not possible!
0
 
LVL 12

Expert Comment

by:CB_Thirumalai
ID: 23485453
I have not said it to write that in global.asax, but in the page where you are catching the error, as said by sankar_ravi.
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 23485564
I get the following error although the system successfully redirect to my error.aspx page!
 
  Server Error in '/demo' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration>
1
 

Expert Comment

by:snyderkv
ID: 34680765
After turrning custom errors off as described above, I was able to see the FIPS was my issue. Some new 2008 security feature. Turned it off and rebooted. The website works.

Thanks
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question