HELP! CustomerSession is empty when rewriting urls from .aspx to .html

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anos atrás
Hello,

I am facing a blocking problem due to the rewriting of urls from .aspx to .html (absolute need from my customer)

The symptom is surprising, because sessions and cart are routinely lost for anonymous users, but not for registered users.
For example, an anonymous user select a product, then go to his cart: the basket is still empty.
I the user is already logged when filling his cart: no problem!
If I stop rewriting urls from .aspx to .html, the problem disapear!!!

When this problem appears, in debug mode, I saw that when cart is loading in GetCurrentShoppingCart method, NopContext.Current.Session still returns null...

Below you can see a part of my web.config file, did I forget to configure something else?
Thanks for your help

Nicolas (france)

This is my
<httpHandlers>
  ...
  <add verb="*" path="*.html" type="System.Web.UI.PageHandlerFactory" />
</httpHandlers>

<system.webServer>
  ...
  <handlers>
    ...
    <add name="HtmlHandler-Integrated" path="*.html"
        verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory"
        modules="ManagedPipelineHandler" requireAccess="Script" preCondition="integratedMode" />

   </handlers>
</system.webServer>
13 anos atrás
Open CommonHelper.IsContentPageRequested() method and replace
if (!request.Url.LocalPath.ToLower().EndsWith(".aspx") &&
!request.Url.LocalPath.ToLower().EndsWith(".asmx") &&
!request.Url.LocalPath.ToLower().EndsWith(".ashx"))
{
      return false;
}

with
if (!request.Url.LocalPath.ToLower().EndsWith(".aspx") &&
!request.Url.LocalPath.ToLower().EndsWith(".asmx") &&
!request.Url.LocalPath.ToLower().EndsWith(".ashx") &&
!request.Url.LocalPath.ToLower().EndsWith(".html"))
{
      return false;
}
13 anos atrás
you are awesome!

It works perfectly now, thanks so much!!!

Just another question on the same topic : Before html, I tried to rewrite to htm, but I had a problem with real htm pages like ErrorPage.htm.
Do you think there is a solution to use the same extension (htm) for static pages and dynamic rewriten pages?

Thanks
13 anos atrás
You can use both of them (htm and html)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.