473,503 Members | 1,657 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is this how session and application variables work?

I've got two domain names sharing the same IP address that use ASP VBScript

If I set a session variable with domain 1, it is only available for domain 1 - this is
correct?

If I set an application variable with domain 1, the app variable is sharing across all
domains using that IP address - this is correct?

This is the behavior I am seeing and I want to make sure that my server is set up
correct. I especially want to make sure application variable behavior is correct.

Thank you!



Jul 30 '06 #1
7 2222
session variables are for the same web application only, are you talking
about the same web application accessed via 2 domains?
"Victor" <vi*@vic.comwrote in message
news:ON**************@TK2MSFTNGP06.phx.gbl...
I've got two domain names sharing the same IP address that use ASP
VBScript

If I set a session variable with domain 1, it is only available for domain
1 - this is
correct?

If I set an application variable with domain 1, the app variable is
sharing across all
domains using that IP address - this is correct?

This is the behavior I am seeing and I want to make sure that my server is
set up
correct. I especially want to make sure application variable behavior is
correct.

Thank you!



Jul 31 '06 #2

"Victor" <vi*@vic.comwrote in message
news:ON**************@TK2MSFTNGP06.phx.gbl...
I've got two domain names sharing the same IP address that use ASP
VBScript
>
If I set a session variable with domain 1, it is only available for domain
1 - this is
correct?

If I set an application variable with domain 1, the app variable is
sharing across all
domains using that IP address - this is correct?
Nope. The problem is that inorder for the server to identify the session it
sets a session cookie which is sent to the browser. The session cookie will
be rooted in a URL which represents the root of the application. If you use
two different domain names to access the same website they cannot share
sessions.

Eg.

A website is accessed as MyServer as well as MyServer.mydomain.com

It has an application called myapp

Visting http://MyServer/MyApp/Default.asp results in the browser receiving a
session cookie rooted at http://MyServer/MyApp/

Now if in the same browser session you visit another page say
http://MyServer/MyApp/SomeFolder/somepage.asp
the session cookie for http://MyServer/MyApp/ is included in the request
because the root path for the cookie matches the URL requested. This
enables ASP to access session variables that may have be created by
Default.asp earlier because the cookie identifies the session.

Now if, again in the same browser session, you visit yet another page say
http://MyServer.mydomain.com/MyApp/AnotherPage.asp the root path of this URL
does not match the path for which the earlier session cookie was created.
Hence the session cookie is not sent in this request. The server sees
request as needing a new session and does not have any idea about the other
session.

Hope this is clear,

Anthony.
This is the behavior I am seeing and I want to make sure that my server is
set up
correct. I especially want to make sure application variable behavior is
correct.
>
Thank you!



Jul 31 '06 #3
I understand your session explanation - thanks! It's the application variable that has
me perplexed.

If www.mydomain1.com and www.mydomain2.com both share the same IP address (domain
aliases), then I thought that their APPLICATION variables, set and read from the domain
root, would still be different. I'm surprised to see that an app variable set with the
first domain is also available to the aliased second domain.

Vic
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>
"Victor" <vi*@vic.comwrote in message
news:ON**************@TK2MSFTNGP06.phx.gbl...
I've got two domain names sharing the same IP address that use ASP
VBScript

If I set a session variable with domain 1, it is only available for domain
1 - this is
correct?

If I set an application variable with domain 1, the app variable is
sharing across all
domains using that IP address - this is correct?

Nope. The problem is that inorder for the server to identify the session it
sets a session cookie which is sent to the browser. The session cookie will
be rooted in a URL which represents the root of the application. If you use
two different domain names to access the same website they cannot share
sessions.

Eg.

A website is accessed as MyServer as well as MyServer.mydomain.com

It has an application called myapp

Visting http://MyServer/MyApp/Default.asp results in the browser receiving a
session cookie rooted at http://MyServer/MyApp/

Now if in the same browser session you visit another page say
http://MyServer/MyApp/SomeFolder/somepage.asp
the session cookie for http://MyServer/MyApp/ is included in the request
because the root path for the cookie matches the URL requested. This
enables ASP to access session variables that may have be created by
Default.asp earlier because the cookie identifies the session.

Now if, again in the same browser session, you visit yet another page say
http://MyServer.mydomain.com/MyApp/AnotherPage.asp the root path of this URL
does not match the path for which the earlier session cookie was created.
Hence the session cookie is not sent in this request. The server sees
request as needing a new session and does not have any idea about the other
session.

Hope this is clear,

Anthony.
This is the behavior I am seeing and I want to make sure that my server is
set up
correct. I especially want to make sure application variable behavior is
correct.

Thank you!





Aug 1 '06 #4
Victor wrote:
I understand your session explanation - thanks! It's the application
variable that has me perplexed.

If www.mydomain1.com and www.mydomain2.com both share the same IP
address (domain aliases), then I thought that their APPLICATION
variables, set and read from the domain root, would still be
different. I'm surprised to see that an app variable set with the
first domain is also available to the aliased second domain.

Vic
I know it's a silly question, but it's got to be asked: have you taken steps
to ensure that the variable value will be different depending on the domain
in which it's running? I mean, you're not just setting an app variable to a
value in the global.asa file and expecting it to only be set in one of the
domains in which it runs are you?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 1 '06 #5

"Victor" <vi*@vic.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
I understand your session explanation - thanks! It's the application
variable that has
me perplexed.

If www.mydomain1.com and www.mydomain2.com both share the same IP address
(domain
aliases), then I thought that their APPLICATION variables, set and read
from the domain
root, would still be different. I'm surprised to see that an app variable
set with the
first domain is also available to the aliased second domain.
Sorry misunderstood your question. Yes the behaviour you are seeing is
correct. The ASP application has not interest in the domain name(s) used to
access it and does not depend on anything from the client to identify the
application. Hence all urls which ultimate resolve to the application folder
(or one of its sub-folders) will identify with the same application on the
web server and will share any application variables.

Anthony.
Vic
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...

"Victor" <vi*@vic.comwrote in message
news:ON**************@TK2MSFTNGP06.phx.gbl...
I've got two domain names sharing the same IP address that use ASP
VBScript
>
If I set a session variable with domain 1, it is only available for
domain
1 - this is
correct?
>
If I set an application variable with domain 1, the app variable is
sharing across all
domains using that IP address - this is correct?
>
Nope. The problem is that inorder for the server to identify the
session it
sets a session cookie which is sent to the browser. The session cookie
will
be rooted in a URL which represents the root of the application. If you
use
two different domain names to access the same website they cannot share
sessions.

Eg.

A website is accessed as MyServer as well as MyServer.mydomain.com

It has an application called myapp

Visting http://MyServer/MyApp/Default.asp results in the browser
receiving a
session cookie rooted at http://MyServer/MyApp/

Now if in the same browser session you visit another page say
http://MyServer/MyApp/SomeFolder/somepage.asp
the session cookie for http://MyServer/MyApp/ is included in the
request
because the root path for the cookie matches the URL requested. This
enables ASP to access session variables that may have be created by
Default.asp earlier because the cookie identifies the session.

Now if, again in the same browser session, you visit yet another page
say
http://MyServer.mydomain.com/MyApp/AnotherPage.asp the root path of this
URL
does not match the path for which the earlier session cookie was
created.
Hence the session cookie is not sent in this request. The server sees
request as needing a new session and does not have any idea about the
other
session.

Hope this is clear,

Anthony.
This is the behavior I am seeing and I want to make sure that my
server is
set up
correct. I especially want to make sure application variable behavior
is
correct.
>
Thank you!
>
>
>
>
>
>
>


Aug 1 '06 #6

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:Oq**************@TK2MSFTNGP03.phx.gbl...
>
"Victor" <vi*@vic.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
I understand your session explanation - thanks! It's the application
variable that has
me perplexed.

If www.mydomain1.com and www.mydomain2.com both share the same IP address
(domain
aliases), then I thought that their APPLICATION variables, set and read
from the domain
root, would still be different. I'm surprised to see that an app variable
set with the
first domain is also available to the aliased second domain.

Sorry misunderstood your question. Yes the behaviour you are seeing is
correct. The ASP application has not interest in the domain name(s) used to
access it and does not depend on anything from the client to identify the
application. Hence all urls which ultimate resolve to the application folder
(or one of its sub-folders) will identify with the same application on the
web server and will share any application variables.

Anthony.
Vic
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>
"Victor" <vi*@vic.comwrote in message
news:ON**************@TK2MSFTNGP06.phx.gbl...
I've got two domain names sharing the same IP address that use ASP
VBScript

If I set a session variable with domain 1, it is only available for
domain
1 - this is
correct?

If I set an application variable with domain 1, the app variable is
sharing across all
domains using that IP address - this is correct?

>
Nope. The problem is that inorder for the server to identify the
session it
sets a session cookie which is sent to the browser. The session cookie
will
be rooted in a URL which represents the root of the application. If you
use
two different domain names to access the same website they cannot share
sessions.
>
Eg.
>
A website is accessed as MyServer as well as MyServer.mydomain.com
>
It has an application called myapp
>
Visting http://MyServer/MyApp/Default.asp results in the browser
receiving a
session cookie rooted at http://MyServer/MyApp/
>
Now if in the same browser session you visit another page say
http://MyServer/MyApp/SomeFolder/somepage.asp
the session cookie for http://MyServer/MyApp/ is included in the
request
because the root path for the cookie matches the URL requested. This
enables ASP to access session variables that may have be created by
Default.asp earlier because the cookie identifies the session.
>
Now if, again in the same browser session, you visit yet another page
say
http://MyServer.mydomain.com/MyApp/AnotherPage.asp the root path of this
URL
does not match the path for which the earlier session cookie was
created.
Hence the session cookie is not sent in this request. The server sees
request as needing a new session and does not have any idea about the
other
session.
>
Hope this is clear,
>
Anthony.
>
This is the behavior I am seeing and I want to make sure that my
server is
set up
correct. I especially want to make sure application variable behavior
is
correct.

Thank you!







>
>


Aug 2 '06 #7
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:Oq**************@TK2MSFTNGP03.phx.gbl...
Sorry misunderstood your question. Yes the behaviour you are seeing is
correct. The ASP application has not interest in the domain name(s) used to
access it and does not depend on anything from the client to identify the
application. Hence all urls which ultimate resolve to the application folder
(or one of its sub-folders) will identify with the same application on the
web server and will share any application variables.

Anthony.
This makes sense. Thank, Anthony.

Vic

Aug 2 '06 #8

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

Similar topics

5
6125
by: Gmmi | last post by:
Is it true that when your ASP application jump's from one Virtual Directory to another Virtual directory then you cannot access session variables (which you created in previous virtual directory...
3
1952
by: Dave Ainslie | last post by:
How do I send session variables between two web directories? I have two sites on my web server I wish to send cookies between. Thanks in advance Dave
7
2297
by: Adam Short | last post by:
I'm having all sorts of problems with Sessions, I've been using them for years with out a hitch, all of a sudden the last 6 - 12 months since getting our new Win2003 server it's all gone shakey!!!...
0
1320
by: Michael | last post by:
I have a problem here that only seems to happen on the one new server that we are migrating our ASP.Net application to. The server is a Windows 2000 SP4 box. It initially had the .Net Framework...
3
3300
by: bennett | last post by:
In the web.config file for my application, in the <sessionState> section I have set timeout="120" (in minutes), but session state variables in my application seem to be expiring in about 5 minutes....
10
3478
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...
5
548
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know...
18
3401
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...
5
1663
by: Terry On Windigo | last post by:
I think I have figured out my problem but I don't know how to solve it. We are going to start using a forums package and do not want our users to have to login to both our site, and then again to...
0
7198
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
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
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
5570
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,...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.