Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alexey Badyl 33 posts 205 karma points
    Aug 30, 2013 @ 10:00
    Alexey Badyl
    0

    Cookies not shared between sub domains

    Hi, according to license agreement I can you one license for one top domain. But how can I use currentOrderId between two subdomains?

    For now we have 2 websites:

    demosite.local
    store.demosite.local


    And I whould loke to see updated ''mini cart" on both websites. I enabled "Use Cookies", but found that when server send cookies to browser cookie don't have correct domain.

    Now it is demosite.local but should be .demosite.local to make sure it will work on both.

    Any Idea how can I solve this issue?

    Thanks!.

     

  • Rune Grønkjær 1371 posts 3102 karma points
    Aug 30, 2013 @ 10:26
    Rune Grønkjær
    0

    I know we have had that working in Tea Commerce v1, but i personally never tried it in v2. We will have a look at it and get back to you.

    /Rune

  • Alexey Badyl 33 posts 205 karma points
    Aug 30, 2013 @ 10:41
    Alexey Badyl
    0

    Hi, I already checked by Reflector and found that domain not set at all by code. So context donain are used.

  • Alexey Badyl 33 posts 205 karma points
    Aug 30, 2013 @ 10:45
    Alexey Badyl
    100

    I found temporary solution. See bellow.

    public class CookiesChangeModule : IHttpModule
        {
            public void Init(HttpApplication context)
            {
                context.PreSendRequestHeaders += new EventHandler(this.OnPreSendRequestHeaders);
            }

            public void Dispose()
            {
            }

            private void OnPreSendRequestHeaders(object sender, EventArgs e)
            {
                HttpApplication application = (HttpApplication)sender;
                HttpContext context = application.Context;

                foreach (string cookieName in context.Response.Cookies)
                {
                    if (cookieName.StartsWith("teacommerce"))
                    {
                        HttpCookie cookie = context.Response.Cookies[cookieName];
                        cookie.Domain = ".demosite.local";
                        break;
                    }
                }
            }
        }

     

    Thanks for fast response. I thisk it will be fixed soon by TeaCommerce)

  • Anders Burla 2560 posts 8256 karma points
    Sep 06, 2013 @ 16:02
    Anders Burla
    0

    You can use the httpCookies in the web.config - see this link: http://patrickdesjardins.com/blog/httpcookie-and-web-config-domain

    <system.web>
       <httpCookies domain=".domain.com"/>
    </system.web>

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft