HttpCompression breaks payment completion redirect

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello,
I can reproduce this issue using Nopcommerce 2.30 downloaded straight from your site with no modifications.

The issue is as follows:
A number of payment handlers require posting of data and redirection to another site (Worldpay, paypal, etc.). This is achieved by building a form and using the Post method of the RemotePost class to build up a HTML page and replace the current response with this html. When HttpCompression is enabled this does not work correctly and a blank page is displayed (0 bytes are passed back to the browser).

This issue can be simply reproduced by enabling httpcompression from the nopcommerce settings screen and modifying the Index action of the Home controller as follows (for testing purposes)

public ActionResult Index()
  {    
            Response.Write("test");
            Response.End();
            return View();
  }


The issue itself appears to be caused by the following lines:

if (acceptEncoding.Contains("GZIP"))
            {
                response.AppendHeader("Content-encoding", "gzip");
                response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
            }
            else if (acceptEncoding.Contains("DEFLATE"))
            {
                response.AppendHeader("Content-encoding", "deflate");
                response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
            }


Turning httpcompression off (or even commenting out these lines) will allow the response to be updated correctly, turning it back on will cause the error to occur again
12 years ago
Everything works fine. Could test it on our demo site? Does it work?
What browser are you using?
12 years ago
Hey Alex,
I'm using Chrome but see the same issue in FF and IE. I'm running the site in IIS Express and am wondering if that has anything to do with it. I'm going to do some more digging this weekend and will let you know what I come up with.
Thanks
Jason
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.