Go to previous topic
Go to next topic
Last Post 10/23/2020 4:46 PM by  Will Strohl
Exceptions in event log
 10 Replies
 1 Subscribed to this topic
 1 Subscribed to this forum
Author Messages





Advanced Member






--
3/16/2018 3:59 AM
    I've noticed in HCC 3.0.1 and 3.1.0 also in default installations some exceptions in event log with this message: Server cannot append header after HTTP headers have been sent
    Looking at them I've also noticed that a case in which they are fired is when I go from Cart page on Checkout page after clicking on 'Secure Checkout' button
    Below you can see one of these exceptions:
    [img=http://95.110.156.198/ForumImages/Hotcakes-ServerError.jpg]Server cannot append header after HTTP headers have been sent[/img]
    Nobody else has noticed this? What could it be? and how could it be solved?
    Thanks!





    Basic Member






    --
    3/16/2018 4:18 AM
    Yeah, I had a large number of these logs. I did report this issue months ago.





    Basic Member






    --
    3/16/2018 6:21 AM
    I see these events in a few portals. Most of them do not have HCC installed, therefore it seems more of an DNN related issue.





    Advanced Member






    --
    3/16/2018 8:54 AM
    Reto, your answer is not useful, I manage more than one hundred websites built with DNN and I have hardly ever seen this exception before.
    Instead in a clean installation of HCC, after a while I can find many.
    Furthermore, as I have already written, I have ascertained that the exception is regularly generated in the passage from the Cart page to the Checkout page, so it's definitely something related to HCC.





    Basic Member






    --
    3/16/2018 9:06 AM
    Hi Scippy

    I do apologise if my answer seemed unhelpful or like I would dismiss any influence of HCC.
    Let me rephrase: From what I see in our logs, this problem does not seem to only affect HCC. There are more modules / scenarios where we see the same message.
    Until now we were not able to pinpoint the exact reason behind. I see you have tracked it down (That is really helpful) and we will certainly try to investigate in this area too.

    My comment was ment to provide additional information. We're all in the same boat, and english is not my first language, so it might sometimes not be perfectly on the point.

    I really appreciate your effort you are putting into the HCC ecosystem!
    Cheers, Reto





    Veteran Member






    --
    3/19/2018 2:34 PM
    It's great to see everyone collaborating on this before I even read the thread. It's great stuff! :)

    We've looked into this in the past, and I agree with Reto. While we definitely see this in some Hotcakes instances, it's not all of them, and we've yet to be able to consistently duplicate the issue. As you many know, until you know the actual cause through consistently duplicating an issue, the necessary code update(s) is unknown. If you all can help find the root cause, I'm certain someone can fix it.
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes





    Advanced Member






    --
    3/20/2018 5:40 AM
    To duplicate the issue only click on 'Secure Checkout' button on any HCC 3.1.0 or 3.0.1 installation
    [img=http://95.110.156.198/ForumImages/SecureCheckout.jpg]Secure Checkout Button[/img]
    About help to find the root cause I'm sorry but I'm not a programmer, I hope someone else can help.





    Advanced Member






    --
    3/21/2018 10:48 AM
    I've great news about this issue!
    Searching on Google I've found a lot of post about this MVC exception ([url=https://stackoverflow.com/questions/34270192/server-cannot-append-header-after-http-headers-have-been-sent-exception-at-html?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa]this one of them[/url]) and it seems to be caused by use of
     
    in fact, looking at HCC source code, in the CartController.cs when the 'Secure Checkout' button is pressed is called the ActionResult IndexPost() where is called the void ForwardToCheckout with in turn a call to Checkout controller using just Response.Redirect
    I did a quick test modifing the ActionResult IndexPost() in CartController in this way:
    [CODE] // POST: /Cart/ [ActionName("Index")] [HccHttpPost] public ActionResult IndexPost() { var model = IndexSetup(); LoadCart(model); var intResult = CartIntegration.Create(HccApp).BeforeProceedToCheckout(HccApp, model); if (!intResult.IsAborted) { if (CheckForStockOnItems(model)) { return Redirect(Url.RouteHccUrl(HccRoute.Checkout, null, Uri.UriSchemeHttps)); //ForwardToCheckout(model); } } else { FlashWarning(intResult.AbortMessage); } return View(model); }

    In this quick test I bypass the ForwardToCheckout call replacing directly with a 'return Redirect' to Checkout, and this remove all exceptions.
    Then I am therefore reasonably sure that the part of the source code to be corrected is that part.
    I do not know if the Response.Redirect was also used in other parts of the HCC project, in that case it is to be reviewed in all the points where it was used.





    Veteran Member






    --
    3/21/2018 1:06 PM
    This is great stuff, Scippy. Would you mind please creating an issue for this so we can make the investigation, development, testing, and eventual release of this official? Thanks! :)

    https://github.com/HotcakesCommerce/core/issues
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes





    Advanced Member






    --
    3/22/2018 3:55 AM
    Sure! I've reported it on [url=https://github.com/HotcakesCommerce/core/issues/112]Github Core Issues[/url]





    Veteran Member






    --
    10/23/2020 4:46 PM
    This should hopefully finally be resolved in today's 3.5 release.
    https://hotcakescommerce....712-Release-03-05-00
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes


    ---