473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Jan 22 '07 #1
6 1893

"Victor" <vi*@vic.comwrote in message
news:OG**************@TK2MSFTNGP05.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.


Jan 23 '07 #2
Just to clarify a bit...

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:uT***************@TK2MSFTNGP06.phx.gbl...
>
"Victor" <vi*@vic.comwrote in message
news:OG**************@TK2MSFTNGP05.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.


Jan 25 '07 #3
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.
Jan 29 '07 #4

"Victor" <vi*@vic.comwrote in message
news:OX**************@TK2MSFTNGP04.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
Jan 29 '07 #5
On 22 Jan, 23:35, "Victor" <v...@vic.comwrote:
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

Feb 1 '07 #6

<go****@walkerwebworks.co.ukwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
On 22 Jan, 23:35, "Victor" <v...@vic.comwrote:
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?

Feb 1 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
6
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter,...
4
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
3
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
12
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.