 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 28th, 2004, 10:27 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
single login for different domains
hi
suppose i haf 3 different websites, how do i setup a login feature so that if a user login at website A, then if he goes to website B, he will be automatically logged in? or is it even possible?
i'm not too familiar with cookies except that domains can only access cookies from the respective domain, so, issit possible to set a cookie for use throughout the 3 websites, so i can at least pass the userID around the 3 websites
|
|

April 28th, 2004, 10:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
AFAIK Cookies are set and operated at the client side. I am not sure about the cookies you mean for respective domains.
Where do you use the UserID actually? Where is it taken from? Do you store the user details in database? If so, Is the database server accessible from all the three domains/websites that you mean? If yes, then you can use the same database for all the three websites.
Are these three website that you say are interlinked. I mean is there a link provided in every website to switch to the other 2 websites?
May be you can use Session for this. Just a thought.
Once the user logs in to one website (say website A) with a UserId, you can set a session variable and maintain it throughout the website A, then when he tries to switch to website B, you can submit the session variable from Website A to Website B, check if the user is valid(only if you are able to connect to database server from all the 3 website) and then on validation set the session variable there in website B. This way you can maintian the same user roam around all the three websites.
Hope that helps
Cheers!
-Vijay G
|
|

April 28th, 2004, 11:06 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks, well, i was just thinking of this scenario when i was browsing different websites powered by 1 main website which lack this single login thing, and so i wanted to try to do it in ASP so i dunno how the database is setup
suppose the websites are on different physical servers, would it still be possible??
|
|

April 28th, 2004, 11:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Yes it would be possible. Keeping that in mind I did reply that. But you should see to that you have access to the same database from all the three.
Maintaining session would be as follows.
Should any request from the other website A goes to Website be, it would be a submit of Session variable of website A and the URL of website B that you are trying to access. Then after validating the user and setting the session variable in Website B, forward it to the URL of Website B.
-Vijay G
|
|

April 29th, 2004, 01:13 AM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hmm..ok thanks
i was also trying out saving the ip address and userid of the user into a server-side file, so when the user goes to website B or website C from other browser windows, the page just looks for corresponding ip address in the file and logs him in automatically, and if he logs out or time expires, the file just removes the line with his ip and userid
just dunno would it cost too much system resources or issit smart programming if lots of users are logged in at once, since theres 3 different websites
|
|

April 29th, 2004, 01:25 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
This too is a good solution.
When you say you are storing IP and UserId in a file, is that a Plain text file or anything else? If a plain text file, are you creating seperate files for every user and deleting the file as such, when the user logs off? If you create single text file and store all the IP/UserId details there for every active user, then deletion of the same when one logs off would be a tough job.
Or
Are you are planning to store it in Database? If it is going to be in a database it is easy to manipulate when you wanted to delete the userId and IP records, when he logs off/time expires.
BTW, for time expiration functionality, I hope you are going to use session.
When you go for Session based solution, and the hitcount to the websites are huge, then I wont recommend you to go for it. As the sessions are stored in Server. But in you case, as there are three website, at any point of time, the User is going to be active on one website, I dont see any issues with it. But still you should consider the hitcount, if you wanted to go for this.
You should consider all factors and derive at a wise decision.
You also make me think.;) Thanks for that.
Cheers!
-Vijay G
|
|

April 29th, 2004, 01:53 AM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
heh, i was thinking of using plain text file for all users, somehow, using database just didnt enter my mind, database should be much better
thanks for all ur advice too
|
|
 |