473,779 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to keep cookies or sessions between 2 sites?

Hello,

I have 2 separate web sites on 2 different boxes

www.xyz.com on box 1
www2.xyz.com on box 2

Users log into box 1 via regular ASP/Database authentication, and I keep a
session variable to mark authenticated users.

There's a link that would send users to box #2 at www2.xyz.com. How do I
check whether these users are authenticated or not? I do not want to present
a login screen again. Is it possible? If so, what are ways to do it, if not
session/cookies?

Thanks!

HH
Jul 19 '05 #1
5 3534
Dont believe so.
Best I could suggest is pass it as a hidden form field or in a DB

--
----------------------------------------------------------
Curt Christianson (Software_AT_Da rkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Hung Huynh" <hu***@wi.rr.co m> wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
Hello,

I have 2 separate web sites on 2 different boxes

www.xyz.com on box 1
www2.xyz.com on box 2

Users log into box 1 via regular ASP/Database authentication, and I keep a
session variable to mark authenticated users.

There's a link that would send users to box #2 at www2.xyz.com. How do I
check whether these users are authenticated or not? I do not want to present a login screen again. Is it possible? If so, what are ways to do it, if not session/cookies?

Thanks!

HH

Jul 19 '05 #2
Assuming that both boxes have access to the same database, you can use some
text, number, or GUID that uniquely identifies the user's session. When the
user is authenticated against your database through Site 1, store this
identifier in the database and return it to the page which will transfer to
Site 2. The hidden form field suggested by Curt is a good way to do it, as
is encoding it in a query string.

Since I'm not sure I've concisely demonstrated my command of the English
language, here's a walk-through example.

1. User visits www.xyz.com (Site 1) and enters login information.
--> Your script or stored procedure compares login information to the
database.
--> The login info matches, so the script or stored procedure generates the
unique session id 12345678-9012-3456-7890-123456789012
--> The unique id is stored in the database and returned to your ASP script.

2. Your ASP script rolls this unique id into a hidden form field or
hyperlink, such as
<A HREF="http://www2.xyz.com/transfer.asp?Un iqueSessionID=< %=
UniqueSessionID %>">Transfer! </A>
-- or --
<FORM NAME="formTrans fer" ACTION="http://www2.xyz.com/transfer.asp"
METHOD="POST">
<INPUT TYPE="hidden" NAME="UniqueSes sionID" VALUE="<%=
UniqueSessionID %>">
<INPUT TYPE="submit" VALUE="Transfer !">
</FORM>

3. The user clicks the link or submits the form, which takes them to
www2.xyz.com (Site 2).
--> The ASP script "transfer.a sp" reads
Request.Queryst ring("UniqueSes sionID") [or Request.Form("U niqueSessionID" )
--> The ASP script looks for a matching record in the database for an
authenticated user with UniqueSessionID
--> A match is found, and any permissions/credentials/other pertinent
information is loaded from the database (not from cookies or Session
variables)

3. The user browses around Site 2.

4. The user logs out of Site 2 (or the session times out).
--> In your logout script and/or Session_OnEnd event, you include code to
clear out the UniqueSessionID from the database, indicating that the session
is no longer active.
A couple of final thoughts and notes:
- This is not a 100% hackproof solution, but it should work pretty well for
your needs, especially if the only thing you pass between servers is the
UniqueSessionID and the UniqueSessionID expires when the user logs off.
- Although you're certainly free to write extra code to come up with a
unique or semi-unique session id, there's no reason you can't use the
SessionID property for this particular application. You don't need the id
to be unique across days or years, you only need to identify the
authenticated user during the jump between domains.
- For that matter, if the user is not likely to ever go
Site1-->Site2-->Site1, there's really no need to persist the id in the
database after the initial transfer. You could delete it immediately and
increase security (because it would prevent anyone else from using that id
to connect to Site 2).

That's all I've got for now, though it can certainly be refined. Hope it
helps!

--Boris

"Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
news:uL******** ******@tk2msftn gp13.phx.gbl...
Dont believe so.
Best I could suggest is pass it as a hidden form field or in a DB

--
----------------------------------------------------------
Curt Christianson (Software_AT_Da rkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
..Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Hung Huynh" <hu***@wi.rr.co m> wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
Hello,

I have 2 separate web sites on 2 different boxes

www.xyz.com on box 1
www2.xyz.com on box 2

Users log into box 1 via regular ASP/Database authentication, and I keep a session variable to mark authenticated users.

There's a link that would send users to box #2 at www2.xyz.com. How do I
check whether these users are authenticated or not? I do not want to

present
a login screen again. Is it possible? If so, what are ways to do it, if

not
session/cookies?

Thanks!

HH


Jul 19 '05 #3
Thanks Curt and Boris for a detailed walk-through. I prefer capturing ID in
database table rather than passing it via hidden form field for security
reason. I may even incorporate some sort of time limit between the transfer.
I like Boris's suggestion of deleting ID from table right away after the
transfer, since I can create a new session var with this ID at site2, and
this should persist.

Once again, thank you both.

HH

"Boris Nikolaevich" <bo***@nikolaev ich.mailshell.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Assuming that both boxes have access to the same database, you can use some text, number, or GUID that uniquely identifies the user's session. When the user is authenticated against your database through Site 1, store this
identifier in the database and return it to the page which will transfer to Site 2. The hidden form field suggested by Curt is a good way to do it, as is encoding it in a query string.

Since I'm not sure I've concisely demonstrated my command of the English
language, here's a walk-through example.

1. User visits www.xyz.com (Site 1) and enters login information.
--> Your script or stored procedure compares login information to the
database.
--> The login info matches, so the script or stored procedure generates the unique session id 12345678-9012-3456-7890-123456789012
--> The unique id is stored in the database and returned to your ASP script.
2. Your ASP script rolls this unique id into a hidden form field or
hyperlink, such as
<A HREF="http://www2.xyz.com/transfer.asp?Un iqueSessionID=< %=
UniqueSessionID %>">Transfer! </A>
-- or --
<FORM NAME="formTrans fer" ACTION="http://www2.xyz.com/transfer.asp"
METHOD="POST">
<INPUT TYPE="hidden" NAME="UniqueSes sionID" VALUE="<%=
UniqueSessionID %>">
<INPUT TYPE="submit" VALUE="Transfer !">
</FORM>

3. The user clicks the link or submits the form, which takes them to
www2.xyz.com (Site 2).
--> The ASP script "transfer.a sp" reads
Request.Queryst ring("UniqueSes sionID") [or Request.Form("U niqueSessionID" )
--> The ASP script looks for a matching record in the database for an
authenticated user with UniqueSessionID
--> A match is found, and any permissions/credentials/other pertinent
information is loaded from the database (not from cookies or Session
variables)

3. The user browses around Site 2.

4. The user logs out of Site 2 (or the session times out).
--> In your logout script and/or Session_OnEnd event, you include code to
clear out the UniqueSessionID from the database, indicating that the session is no longer active.
A couple of final thoughts and notes:
- This is not a 100% hackproof solution, but it should work pretty well for your needs, especially if the only thing you pass between servers is the
UniqueSessionID and the UniqueSessionID expires when the user logs off.
- Although you're certainly free to write extra code to come up with a
unique or semi-unique session id, there's no reason you can't use the
SessionID property for this particular application. You don't need the id
to be unique across days or years, you only need to identify the
authenticated user during the jump between domains.
- For that matter, if the user is not likely to ever go
Site1-->Site2-->Site1, there's really no need to persist the id in the
database after the initial transfer. You could delete it immediately and
increase security (because it would prevent anyone else from using that id
to connect to Site 2).

That's all I've got for now, though it can certainly be refined. Hope it
helps!

--Boris

"Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
news:uL******** ******@tk2msftn gp13.phx.gbl...
Dont believe so.
Best I could suggest is pass it as a hidden form field or in a DB

--
----------------------------------------------------------
Curt Christianson (Software_AT_Da rkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
..Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Hung Huynh" <hu***@wi.rr.co m> wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
Hello,

I have 2 separate web sites on 2 different boxes

www.xyz.com on box 1
www2.xyz.com on box 2

Users log into box 1 via regular ASP/Database authentication, and I keep
a
session variable to mark authenticated users.

There's a link that would send users to box #2 at www2.xyz.com. How do
I check whether these users are authenticated or not? I do not want to

present
a login screen again. Is it possible? If so, what are ways to do it,

if not
session/cookies?

Thanks!

HH



Jul 19 '05 #4
Hi,

I might be missing something here - ASP session state certainly won't
fly between different boxes, but you can persist 'normal cookies'
between boxes on the same domain.

so.. depending on your scheme for authenticating, you could throw a
cookie on box1 with (syntax a bit rusty) a 'domain' property of
'xyz.com', and you would be able to read this OK on box 2. I guess
you could store the 'REMOTE_USER' server variable or a 'session id' or
something similar - not a password of course!!

The other answers about global 'session state' also make a lot of
sense and is how I normally tend to do it (you can't necessarily
assume that people have cookies switched on).

HTH

Matt Simner

"Hung Huynh" <hu***@wi.rr.co m> wrote in message news:<uR******* *******@TK2MSFT NGP09.phx.gbl>. ..
Hello,

I have 2 separate web sites on 2 different boxes

www.xyz.com on box 1
www2.xyz.com on box 2

Users log into box 1 via regular ASP/Database authentication, and I keep a
session variable to mark authenticated users.

There's a link that would send users to box #2 at www2.xyz.com. How do I
check whether these users are authenticated or not? I do not want to present
a login screen again. Is it possible? If so, what are ways to do it, if not
session/cookies?

Thanks!

HH

Jul 19 '05 #5
there are some free com objects that handle this

"Matt Simner" <ma*********@ho tmail.com> wrote in message
news:6d******** *************** ***@posting.goo gle.com...
Hi,

I might be missing something here - ASP session state certainly won't
fly between different boxes, but you can persist 'normal cookies'
between boxes on the same domain.

so.. depending on your scheme for authenticating, you could throw a
cookie on box1 with (syntax a bit rusty) a 'domain' property of
'xyz.com', and you would be able to read this OK on box 2. I guess
you could store the 'REMOTE_USER' server variable or a 'session id' or
something similar - not a password of course!!

The other answers about global 'session state' also make a lot of
sense and is how I normally tend to do it (you can't necessarily
assume that people have cookies switched on).

HTH

Matt Simner

"Hung Huynh" <hu***@wi.rr.co m> wrote in message

news:<uR******* *******@TK2MSFT NGP09.phx.gbl>. ..
Hello,

I have 2 separate web sites on 2 different boxes

www.xyz.com on box 1
www2.xyz.com on box 2

Users log into box 1 via regular ASP/Database authentication, and I keep a session variable to mark authenticated users.

There's a link that would send users to box #2 at www2.xyz.com. How do I
check whether these users are authenticated or not? I do not want to present a login screen again. Is it possible? If so, what are ways to do it, if not session/cookies?

Thanks!

HH

Jul 19 '05 #6

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

Similar topics

5
3191
by: TG | last post by:
This is more of a pain than I thought it would be. I need a simple code segment to determine whether a browser accepts cookies or not. When I pass variables between pages when cookies are turned off, the global variables are empty between pages, fine, that tells me cookies store the global variables - right? I store the values in $_session and when cookies are turned on values are passed between web pages - I can see these values in fields...
6
3119
by: Anonymous | last post by:
Hi! I've got an unusual problem here. I'm trying to write a PHP script that behaves like a web client. Why? I want to automatically check specific URLs for changes. I'm using file_get_contents(URL) to read the pages and this seems to work just fine as long as there are no logins, sessions or cookies. But I'm getting a new PHPSESSID from the site whenever I get a new page
1
2824
by: windandwaves | last post by:
Hi Gurus I am basically sorry that I have to bother you about this. I am a PHP beginner and I have been studying sessions and cookies over the last few weeks. I have learned lots, but I am missing the big picture. Is it like this: 1. user comes to site 2. user does something (e.g. a search) that may be useful later => session
1
4472
by: d.schulz81 | last post by:
Hi all, We have about 10 different domains that are linked very closely and we want to identify and keep track of every single user that surfs our websites by the use of sessions. The problem is how to keep track of the session ID across domains. - cookies don't work because not acepted by 40 % of or users and cookies don't work across domains
2
3347
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of the user. I want that cookie should get deleted when user closes the browser without signing out. I think it is done in global.asa file . But i don;t know how to do it?
1
1249
by: Scott Collens | last post by:
I am hoping someone can shed some light on this issue. I am developing a site in .NET using VB.NET on Windows 2000 Advanced Server. As I browse the site, if I delete my cookies through the browser tools, the site hangs when I continue to navigate. I was wondering if this has anything to do with the ASP.NET_SessionId session state cookie? If so, Is there anyway to eliminate this
2
1176
by: Arno Seitinger | last post by:
Hi, how I have to handle cookies between asp and asp.net? between two asp sites it works fine, so I can use the sessions direct. but not between an asp site and an apx site. thanks arno
5
2812
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We have been looking our asses off but can not find a working solution. the code we came up with is ...
7
2019
by: Marcus | last post by:
I know that when you start a session in PHP, the "cookie" it creates is not the same as those that are stored in your browser's temp folder, and instead is kept in RAM. I am confused because in every session tutorial I have ever read, the author invariably mentions the 2 main ways of propagating sessions - through cookies and appended to the URL. The author also almost always talks about the method being dependent on the user's...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
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 we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.