Scippy
  •  Scippy
  • 100% (Exalted)
  • Advanced Member Topic Starter
2018-03-16T07:59:30Z
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:
Server cannot append header after HTTP headers have been sent
Nobody else has noticed this? What could it be? and how could it be solved?
Thanks!
Kurt
  •  Kurt
  • 78.25% (Friendly)
  • Member
2018-03-16T08:18:48Z
Yeah, I had a large number of these logs. I did report this issue months ago.
Reto Cossalter
2018-03-16T10:21:32Z
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.
Scippy
  •  Scippy
  • 100% (Exalted)
  • Advanced Member Topic Starter
2018-03-16T12:54:08Z
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.
Reto Cossalter
2018-03-16T13:06:51Z
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
Will Strohl
2018-03-19T18:34:55Z
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
Scippy
  •  Scippy
  • 100% (Exalted)
  • Advanced Member Topic Starter
2018-03-20T09:40:52Z
To duplicate the issue only click on 'Secure Checkout' button on any HCC 3.1.0 or 3.0.1 installation
Secure Checkout Button
About help to find the root cause I'm sorry but I'm not a programmer, I hope someone else can help.
Scippy
  •  Scippy
  • 100% (Exalted)
  • Advanced Member Topic Starter
2018-03-21T14:48:20Z
I've great news about this issue!
Searching on Google I've found a lot of post about this MVC exception (this one of them ) and it seems to be caused by use of
Response.Redirect
instead
return Redirect

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:

// 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.
Will Strohl
2018-03-21T17:06:00Z
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
Scippy
  •  Scippy
  • 100% (Exalted)
  • Advanced Member Topic Starter
2018-03-22T07:55:49Z
Users browsing this topic
    Loading
    • Sign-up for the Hotcakes Community Newsletter: