Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to keep user session in SQLServer-Database ins

Author  Topic 

cutever
Starting Member

32 Posts

Posted - 2002-04-01 : 00:04:12
Normally, SESSION will be kept on WEB SERVER site.
However, if web server down. E.g. WEB SERVER (1). The user, who login through, and keep their SESSION in WEB SERVER (1), would unable to gain access into the system again.

The system will then direct the user to second WEB SERVER (2). However, the WEB SERVER (2) does not know that user. What user have to do to continue, is re-login and re-do everything in WEB SERVER (2) again.

This has caused the user un-satisfaction.

Is it possible to keep the SESSION into SQL Server 2000 ? How ?

I hope you can provide solution for me. It's very important for me. I hope you can help me.

Thank You !!!


Ver


Ver

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-01 : 00:32:50
Hi

If you are looking to make a switch to .NET, it does this for you. So it is easy. Otherwise, it is still not all that hard.

Basically, you would create a session table, with a seesion ID (I use a GUID). Then a lookup table with the session ID a name and a value column.

When a session starts, create a new session in your session table, and give the user that session ID as a cookie (this is how asp does it). Then put entries into the name/value lookup table as needed. So, if you want to store the users name, you would store "name", "cutever" in the lookup table with the correct session ID. Then to find the username, do a

SELECT SessValue FROM SessionLookup WHERE sessionID = @sessionID and SessName = 'name'

Or something like that.
Obviously there are a few more kins you are going to have to work out. It is too much to put in a forum post. But that is the general idea.

Hope that helps

Damian
Go to Top of Page

cutever
Starting Member

32 Posts

Posted - 2002-04-01 : 01:14:02
Merkin,

Thanks for your reply - "How to keep user session in SQLServer-Database insteat of ASP(web Server)" ^_^

Your solution does help me a lot. However, I still hope that you can provide extra detail information or show some sample for me (in detail)?
Please ~~~~~~~~~~~~ ^o^

Happy Working !!!!

Ver

Ver
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-01 : 05:34:02
Hi

Sorry, for commercial reasons I can not show you code I have written to do this. Also it is too big a job to re-write it here.

If you want to contact me about consulting work I would be happy to discuss it though

Damian
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-01 : 07:37:18
Man,You have got a good business acumen
quote:

If you want to contact me about consulting work I would be happy to discuss it though



--------------------------------------------------------------
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-01 : 07:57:02
It's not something I would normally post here (I never have in the past). But cutever is asking for a lot of code.

Damian
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-01 : 08:24:20
Merkin , i know you never did that.

i think Jay is spreading the bug


--------------------------------------------------------------
Go to Top of Page

Jay99

468 Posts

Posted - 2002-04-01 : 09:00:48
quote:

i think Jay is spreading the bug



Your 'bug' is my dinner . . .

Jay
<O>
Go to Top of Page

Magnus
Starting Member

2 Posts

Posted - 2002-04-01 : 09:04:17
cutever, if you have an account at www.asptoday.com you will find at least one article there implementing what you are looking for. For example, look up the article "Advanced Login Management System using SQL and ASP" under the category "Security Admin". It will among other things show an example of how to keep sessions in a database. This is just one way to do it but it is a good start and you can extend the concepts in the article to fit your own needs. If you don't have an account I'd recommend getting one ;)

/Magnus

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-01 : 09:17:03
cutever, i would recommend you hire Merkin then paying at asptoday.com . Trust me, he can be specific to your needs and can pour all the knowledge the site can give you

Whome are you having tonite for dinner
quote:

Your 'bug' is my dinner . . .




--------------------------------------------------------------


Edited by - Nazim on 04/03/2002 02:23:33
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-01 : 18:09:32
Ha ha ha ha he he he

Are you after some commission there Nazim ?

Damian
Go to Top of Page

cutever
Starting Member

32 Posts

Posted - 2002-04-03 : 01:46:22
hei.......guy, don't play play on my forum.....
Please help me find solution......



Ver
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-03 : 01:52:45
cutever, it isn't your forum.

Your question is also already answered here. I have told you how to do it, but it is a lot of code I am not willing to post in public and give away.

Damian
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-03 : 02:22:43
Lost all hope of commision , cant expect much from a person who claims to own the forum itself that too by asking a question . common Merkin let us find another client

quote:

Are you after some commission there Nazim ?



--------------------------------------------------------------
Go to Top of Page

cutever
Starting Member

32 Posts

Posted - 2002-04-03 : 03:17:08
ok...ok....It's my false.....sorry loh.......this forum is not belong to me. dont angry at me.....please.

HELP ME PLEASE........

Ver
Go to Top of Page

cutever
Starting Member

32 Posts

Posted - 2002-04-03 : 03:41:32
Thanks for your help, I got it !!!

Thank you very much !



Ver
Go to Top of Page

uberbloke
Yak Posting Veteran

67 Posts

Posted - 2002-04-03 : 03:43:44
Right, no code, but this should get you started

Create a sessions table in your database that both the webservers look at

Key one field as a guid (uniqueidentifier)

In web land

When a user hits a page look for a cookie you have set called, oh, say , sessionid.

If it does not exist, new user.
Do login in, validate user, create new entry in sessions table this creates you a unique guid, return that guid and store is as the cookie sessionid on the users browser

If it does exist then grab the sessionid cookie, pass it through to the db to be validated.

You now don't care which webserver does the work.

Once you have got the basics you can do things like session ageing (have a last action field that is updated on every validation that must be within 20 minutes of now (if you want to emulate the default settings for IIS sessions))

etc etc

Have fun writing your own code.




Go to Top of Page
   

- Advertisement -