ASP Session Variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Victor

    ASP Session Variables

    I've got a website that displays the same whether it is accessed using www. or not.

    ex: http://www.mysite.com and http://mysite.com give me exactly the same website (both
    represent the top subdomain).

    HOWEVER... it seems that while they share the same application variables (of course)
    they treat session variables as if they are two different websites. (this is very
    important because when a user clicks a link that switches from one to the other, it
    affects some counters).

    Is there a way to insure that both ways of entering the URL will share the same set of
    session variables???

    Thanks,

    Victor


  • Anthony Jones

    #2
    Re: ASP Session Variables


    "Victor" <vic@vic.comwro te in message
    news:OGeSQ4nPHH A.1756@TK2MSFTN GP05.phx.gbl...
    I've got a website that displays the same whether it is accessed using
    www. or not.
    >
    ex: http://www.mysite.com and http://mysite.com give me exactly the same
    website (both
    represent the top subdomain).
    >
    HOWEVER... it seems that while they share the same application variables
    (of course)
    they treat session variables as if they are two different websites. (this
    is very
    important because when a user clicks a link that switches from one to the
    other, it
    affects some counters).
    >
    Is there a way to insure that both ways of entering the URL will share the
    same set of
    session variables???
    >
    You need to configure a new site. Place a host header entry on the new site
    for mysite.com. This new site should be empty except for a custom 404
    handler which redirects to the www.mysite.com site. Ensure the original
    site has a host header (if any) only for www.mysite.com.

    There is no way for the two different URL to share session variables. ASP
    sessions depend on a in-memory cookie where the URL to the root of the
    application is the path. Since this will vary between with the two names
    they cannot share this cookie.




    Comment

    • Mark J. McGinty

      #3
      Re: ASP Session Variables

      Just to clarify a bit...

      "Anthony Jones" <Ant@yadayadaya da.comwrote in message
      news:uTKu%23wsP HHA.320@TK2MSFT NGP06.phx.gbl.. .
      >
      "Victor" <vic@vic.comwro te in message
      news:OGeSQ4nPHH A.1756@TK2MSFTN GP05.phx.gbl...
      >I've got a website that displays the same whether it is accessed using
      www. or not.
      >>
      >ex: http://www.mysite.com and http://mysite.com give me exactly the same
      website (both
      >represent the top subdomain).
      >>
      >HOWEVER... it seems that while they share the same application variables
      (of course)
      >they treat session variables as if they are two different websites. (this
      is very
      >important because when a user clicks a link that switches from one to the
      other, it
      >affects some counters).
      >>
      >Is there a way to insure that both ways of entering the URL will share
      >the
      same set of
      >session variables???
      >>
      >
      You need to configure a new site. Place a host header entry on the new
      site
      for mysite.com. This new site should be empty except for a custom 404
      handler which redirects to the www.mysite.com site.
      And in that 404 handler be sure to relay any QueryString parameter/value
      pairs to the target, and be certain that none of your pages' internal links
      point to the redirecting domain, and be *absolutely* certain that none of
      your pages' code redirects to the redirecting domain.

      Ensure the original
      site has a host header (if any) only for www.mysite.com.
      They must both have host headers if both names resolve to the same IP.
      Further, neither host name can be duplicated in multiple virtual server
      definitions [using the same IP] without causing a bindings conflict.


      -Mark

      There is no way for the two different URL to share session variables. ASP
      sessions depend on a in-memory cookie where the URL to the root of the
      application is the path. Since this will vary between with the two names
      they cannot share this cookie.
      >
      >
      >
      >

      Comment

      • Victor

        #4
        Re: ASP Session Variables

        Thanks, I understand what both of you are writing.

        However... www.mysite.com and mysite.com, by definition and standard, point to the same
        website with the same IP address - that is, the top level subdomain.

        Of course, www2.mysite.com and www.mysite.com can be different websites with different
        IP addresses.


        Comment

        • Mark J. McGinty

          #5
          Re: ASP Session Variables


          "Victor" <vic@vic.comwro te in message
          news:OXp4EB9QHH A.4632@TK2MSFTN GP04.phx.gbl...
          Thanks, I understand what both of you are writing.
          >
          However... www.mysite.com and mysite.com, by definition and standard,
          point to the same
          website with the same IP address - that is, the top level subdomain.
          Not by any standard I've seen, and absolutely not by definition. mysite.com
          and www.mysite.com are 2 separate host names, how they resolve is
          *entirely* up to DNS. If you had said 'by convention', I'd have to agree,
          but that's the extent of it.
          Of course, www2.mysite.com and www.mysite.com can be different websites
          with different
          IP addresses.
          www2 and www are neither no more nor no less related to their parent domain.
          www is merely a very widely used convention, nothing more. It could just
          as easily be xxx. or xyz., the letters themselves mean nothing to DNS, they
          have no special significance.

          Note that if you were talking about regular cookies (as opposed to the
          session cookie) you could use the domain property to allow child domains to
          reference cookies in the parent domain, but you have no control over the
          session cookie at all, it's a black box. So if you need to support multiple
          host names for the same logical site, *and* the ASP session, redirection is
          your solution.


          -Mark


          Comment

          • google@walkerwebworks.co.uk

            #6
            Re: ASP Session Variables

            On 22 Jan, 23:35, "Victor" <v...@vic.comwr ote:
            I've got a website that displays the same whether it is accessed using www. or not.
            >
            ex:http://www.mysite.com andhttp://mysite.comgive me exactly the same website (both
            represent the top subdomain).
            >
            HOWEVER... it seems that while they share the same application variables (of course)
            they treat session variables as if they are two different websites. (this is very
            important because when a user clicks a link that switches from one to the other, it
            affects some counters).
            >
            Is there a way to insure that both ways of entering the URL will share the same set of
            session variables???
            >
            Thanks,
            >
            Victor
            what i would do is have an if statement at the top of the page that
            sais that if header is http://mysite.com then redirect to http://www.mysite.com
            end if

            Comment

            • Anthony Jones

              #7
              Re: ASP Session Variables


              <google@walkerw ebworks.co.ukwr ote in message
              news:1170340886 .251595.316130@ v45g2000cwv.goo glegroups.com.. .
              On 22 Jan, 23:35, "Victor" <v...@vic.comwr ote:
              I've got a website that displays the same whether it is accessed using
              www. or not.

              ex:http://www.mysite.com andhttp://mysite.comgive me exactly the same
              website (both
              represent the top subdomain).

              HOWEVER... it seems that while they share the same application variables
              (of course)
              they treat session variables as if they are two different websites.
              (this is very
              important because when a user clicks a link that switches from one to
              the other, it
              affects some counters).

              Is there a way to insure that both ways of entering the URL will share
              the same set of
              session variables???

              Thanks,

              Victor
              >
              what i would do is have an if statement at the top of the page that
              sais that if header is http://mysite.com then redirect to
              http://www.mysite.com
              end if
              >
              Which page?



              Comment

              Working...