ASP Session Not working

M

Meya

I am using IIS 5.0..

server doesnt pass the session parameters to next pages..
pls anyone can help on this issue..

code:

set rs = server.createobject("adodb.recordset")
sqlquery="select * from account where uid='abc'
and password='123'"
rs.open sqlquery, conn, 3, 3,0

if not rs.eof then
session("acct")= rs("account")
end if
 
R

Ray at

Some basic debugging may be of assistance.


set rs = server.createobject("adodb.recordset")
sqlquery="select * from account where uid='abc'
and password='123'"
rs.open sqlquery, conn, 3, 3,0

if not rs.eof then
session("acct")= rs("account")
RESPONSE.WRITE "NO, NOT EOF."
ELSE
RESPONSE.WRITE "EOF, SO NOTHING IN SESSION"
END IF

And for the obligatory:


Set rs = conn.Execute("SELECT [Account] FROM [Account] WHERE [uid]='abc' AND
[Password]='123'")
If Not rs.EOF Then
Session("acct") = rs.Fields.Item(0).Value
End If

rs.Close : Set rs = Nothing
conn.Close : Set conn = Nothing

Ray at home
 
E

Egbert Nierop \(MVP for IIS\)

Meya said:
I am using IIS 5.0..

server doesnt pass the session parameters to next pages..
pls anyone can help on this issue..

code:

set rs = createobject("adodb.recordset")
sqlquery="select * from account where uid='abc'
and password='123'"
rs.open sqlquery, conn, 3, 3,0

if not rs.eof then
SET session("acct")= rs("account")

But you'd better not do this (as Aaron Betrand pointed with his link). Do
not store object references in the session since this will blow up your
webserver RAM and your scalability soon.
 
A

Aaron Bertrand - MVP

SET session("acct")= rs("account")
But you'd better not do this (as Aaron Betrand pointed with his link). Do
not store object references in the session since this will blow up your
webserver RAM and your scalability soon.

Good catch Egbert, I didn't even notice that.
 
R

Ray at

He probably learned that from the aspfaq.com site that has many references
of rs("colName") instead of the value of the item in the recordset. :p

Ray at work
 
E

Egbert Nierop \(MVP for IIS\)

was OK

if not rs.eof then
session("acct")= rs("account")
end if

The real problem can be because of cookie settings at thte client browser.
Are you sure the browser accepts cookies (temporary cookies)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,366
Latest member
IanCulpepp

Latest Threads

Top