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

    Question by:
    On

    Topics:

    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?
    Good Question?
    1
     

    ?

    The member who asked this question verified this comment provided the solution that solved their problem.

    Accepted Solution on 2009-01-27 at 05:01:06ID: 23475805

    verified

    answer

    Enjoy your free answer!

    Join now to get more tech resources.

    Become a member

    Comments

      

    Accepted Solution

    2009-01-27 at 05:01:06ID: 23475805Best
    Dhaest earned 250 total points
    Good Solution?
    0
     
    CB_Thirumalai

    Assisted Solution

    2009-01-27 at 05:02:44ID: 23475815
    CB_Thirumalai earned 250 total points
    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

    Good Solution?
    0
     
    sankar_ravi

    Expert Comment

    2009-01-27 at 05:07:56ID: 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
    Good Comment?
    0
     
    sankar_ravi

    Expert Comment

    2009-01-27 at 05:11:31ID: 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.
    }
    Good Comment?
    0
     
    Abdu_Allah

    Author Comment

    2009-01-27 at 08:11:23ID: 23477863
    I guess I should write the error message errmessage before this statement: Server.ClearError();  
    right?
     
    Good Comment?
    0
     
    CB_Thirumalai

    Expert Comment

    2009-01-27 at 08:21:54ID: 23478013
    You mean display the message in the page, yes
    Good Comment?
    0
     
    Abdu_Allah

    Author Comment

    2009-01-27 at 12:12:24ID: 23480570
    It does not show any error!
    Good Comment?
    0
     
    Abdu_Allah

    Author Comment

    2009-01-27 at 12:18:09ID: 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?!
    Good Comment?
    0
     
    CB_Thirumalai

    Expert Comment

    2009-01-27 at 16:59:35ID: 23482760
    Ok, if you want to show the error, then do a Response.Write(errEx.ToString()); before Server.ClearError();
    Good Comment?
    0
     
    Abdu_Allah

    Author Comment

    2009-01-28 at 03:27:46ID: 23485404
    Do that in global.asax file! this is not possible!
    Good Comment?
    0
     
    CB_Thirumalai

    Expert Comment

    2009-01-28 at 03:36:35ID: 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.
    Good Comment?
    0
     
    Abdu_Allah

    Author Comment

    2009-01-28 at 03:56:05ID: 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>
    Good Comment?
    0
     
    snyderkv

    Expert Comment

    2011-01-24 at 02:49:17ID: 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
    Good Comment?
    0

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    Ask Your Tech Question. Get Expert Solutions.We will email you as soon as we have your answer.

    We will never share this with anyone.

    Select topics

    You may select up to five topics.

    Top Expert Contributor

    Essential articles and videos from the Experts

    I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    More valuable questions with Expert answers

    Question: Hi When I execute my ASP.NET C# code on VS 2013 I get ERR_CONNECTION_REFUSED I cannot debug I had a look to those posts but no way: ...

    Answer: Hi, It seems there is some problem in your applicationhost.config or port conflict. You can get this file on following path for iis express: for new windows %userprofile%\documents\iisexpress\config\applicationhost.config for old versions...

    Question: Hi I have label which has very long text without any space so I used property word-wrap:break-word; which broken my word in to next line when it exceeded than label width.I tested this with Safari,Chrome and IE 11 With Out compatibilty mode,It...

    Answer: IE 11 comp mode is the equivalent for IE 7, thus this CSS is not supported as shown here (http://caniuse.com/#feat=wordwrap) One possible solution is to use the following CSS style rules: -ms-word-break: break-all; //ie7 ms equivalent of...

    Question: Hello Experts. Is it possible to save the file in the Local PC(user accessing the application on server thru browser) not on the webserver. I'm write a data to excel and saving the file. I don't want to save on webserver, rather save on users...

    Answer: You can create a file, the redirect the browser to that file. That will, generally, prompt the user to open or download the file in question. You cannot "push" a file to the client however.

    Question: (CODE) Shows this header at runtime: How do I manipulate the border style for the header .. to make the border red and yellow instead of black lines and grey lines?

    Answer: You will need to add CSS to your table header <th> so use your existing external css file and create new class. You can set individual column color using id="yourexistingid" or class="red" apply the color based on that. Some references ...

    201607-LO-Qu-086

    Extend your technology team with the Experts Exchange community.

    — trusted by —

    Who answers my questions?Our community has technology experts around the world.

    Mrunal

    1

    Articles

    585

    Solutions

    Expert in:

    • ASP.NET
    • .NET Programming
    • JavaScript
    • AJAX
    • C#

    Dan McFadden

    599

    Solutions

    Expert in:

    • Microsoft IIS Web Server
    • Windows Server 2008
    • Windows Server 2012
    • ASP.NET
    • Active Directory

    Dave Baldwin

    1

    Articles

    11,469

    Solutions

    Expert in:

    • PHP
    • CSS
    • HTML
    • JavaScript
    • MySQL Server

    Manju

    32

    Solutions

    zephyr_hex

    2,675

    Solutions

    Expert in:

    • MS SharePoint
    • MS SQL Server 2005
    • Microsoft IIS Web Server
    • Windows Server 2003
    • Windows XP

    jorge_toriz

    341

    Solutions

    Expert in:

    • ASP.NET
    • .NET Programming
    • C#
    • MS SQL Server
    • MS SQL Server 2005

    Shaun Kline

    860

    Solutions

    Expert in:

    • .NET Programming
    • ASP.NET
    • C#
    • MS SQL Server
    • MS SQL Server 2005

    BigRat

    2,344

    Solutions

    Expert in:

    • Math / Science
    • XML
    • ASP
    • AngularJS
    • Apache Web Server

    Tapan Pattanaik

    735

    Solutions

    Expert in:

    • .NET Programming
    • ASP.NET
    • C#
    • MS SQL Server
    • Web Development-Other

    RELATED TOPICS view all topics

    1. .NET Programming
      (130,871)
    2. C#
      (90,576)
    3. Visual Basic.NET
      (91,299)
    4. JavaScript
      (118,122)
    5. Microsoft IIS Web Server
      (34,770)
    6. Web Development-Other
      (72,546)
    7. AJAX
      (11,977)
    8. MS Development-Other
      (47,892)
    9. ASP
      (80,500)
    10. Web Applications
      (13,941)
    Receive Monthly Emails of Tech News and Trends from Experts Exchange