How to send the error message from the server directly to the client instead of sending fidlercore error messages?

6 posts, 0 answers
  1. the East Wind
    the East Wind avatar
    12 posts
    Member since:
    Sep 2019

    Posted 21 Oct 2019 Link to this post

     I found that fiddlercore will customize the return content based on the HTTP status code. Can I ban this behavior?

    This page has been personalized for various status codes, but Fiddlercore will turn the customized content into Fiddlercore error message. For example, the web 

    page will display some contents like "Http status: 502 Fiddler - Connection Failed ajaxOptions: error thrownError..." if the status code is 502. But at this time, I only

     want the page to show that the connection has failed without the specific error message.

    I wanna know what can I do to show original customized message in Fiddlercore.


  2. Eric R | Senior Technical Support Engineer
    Admin
    Eric R | Senior Technical Support Engineer avatar
    396 posts

    Posted 24 Oct 2019 Link to this post

    Hello,

    Something like this can be accomplished by using the BeforeReturningError event. See the below code snippet for reference.

    FiddlerApplication.BeforeReturningError += delegate(Session oS)
    {
        string sErrMsg = oS.GetResponseBodyAsString();
    
        oS.utilSetResponseBody("<!doctype html><title>AcmeCorp Error Page</title>" + "<body>Sorry, this page or service is presently unavailable. Please try" + " again later. <br /><pre>" + sErrMsg + "</pre></html>"); 
    
    };

    Before I close, I think that a copy of the Debugging with Fiddler would aide your efforts tremendously. I highly recommend picking up a copy. 

    Please let me know if you need any additional information. Thank you for using the Fiddler Forums.

    Regards,


    Eric R | Technical Support Engineer
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. the East Wind
    the East Wind avatar
    12 posts
    Member since:
    Sep 2019

    Posted 27 Oct 2019 Link to this post

    Hi,Eric

    Thank you for your reply

    Actually,at the beginning of learning how to use fiddler, I already bought the book "Debugging with Fiddler". This book is great!

    As for my question,I  mean using the return string of the site itself instead of personalizing it. These sites personalize different status

    codes, and the methods you provide will make the return styles of all sites exactly the same.

    Thank you for your time.

  4. Eric R | Senior Technical Support Engineer
    Admin
    Eric R | Senior Technical Support Engineer avatar
    396 posts

    Posted 28 Oct 2019 Link to this post

    Hello,

    I am glad to hear that book is a great resource for you. As for bypassing the FiddlerCore response, I am not entirely certain I understand the requirement. In order to investigate this in more detail it would be helpful to see your current FiddlerCore implementation. Is it possible for you to attach your code to this thread? Note that this would only need to be the implementation of FiddlerCore.

    Please let me know if this is possible. Thank you and I look forward to your reply.

    Regards,


    Eric R | Technical Support Engineer
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. the East Wind
    the East Wind avatar
    12 posts
    Member since:
    Sep 2019

    Posted 05 Nov 2019 Link to this post

    Hi,Eric

    Thank you for your time and reply

    Actually, in my code, I just saved the request and response without modifying them or affecting the communication.Also, I don't want

    to change the error message.I see that the explanation about BeforeReturningError event is: This event fires when an error

    response is generated by Fiddler.This seems to indicate that when fiddler becomes the proxy, the error messages that occur during

    this period are also in fiddler format and generated by fiddler.If so, how do I get the original error message? because I don't want to

    change anything during the fiddler proxy.

    This sounds like a strange and unreasonable request.Maybe I made a mistake somewhere.

    Thank you for your time again

     

     

  6. Eric R | Senior Technical Support Engineer
    Admin
    Eric R | Senior Technical Support Engineer avatar
    396 posts

    Posted 05 Nov 2019 Link to this post

    Hello,

    Thank you for providing more information. Although, without seeing the implementation it will be difficult to troubleshoot. My only suggestion is to try using the OnBeforeResponse method, check if it is an error and from a particular host and then modifying the response with the response body as output. This might look like below. Note that this requires buffering the response because streamed responses will be passed to the client by default.

    FiddlerApplication.BeforeResponse += delegate (Session session)
    {
        if(session.HostnameIs("AHostName") && session.responseCode == 500)
        {
            string sesh = session.GetResponseBodyAsString();
    
            session.utilSetResponseBody(sesh);
        }
    };

    I hope this helps. Please give this a try and let me know the results. Thank you and I look forward to your reply.

    Regards,


    Eric R | Technical Support Engineer
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top