Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Can't write value into Session items

Posted on 2006-05-31
4
Medium Priority
?
183 Views
Last Modified: 2010-04-06
I am using ASP & VBScript on Windows Server 2003 with SQL Server for database
I am having problem writing value to the Session items and I can't figure out why
I do not have the problem when using Access Database

Below is my code.....

Dim SQL, Rs, strUserID, strPassWD
strUserID = LCase(Request.Form("userid"))
strPassWD = Request.Form("passwd")
ConnectionDatabase
SQL = "SELECT * FROM [Members] WHERE uid = '" & strUserID & "'"
Set Rs = Conn.Execute(SQL)

If Not Rs.EOF Then
    If strPassWD = Rs("upass") Then
        Session("AdminLogin") = "true"
        Session("UserID") = strUserID
    End If
Else
    Response.Redirect "errLoginFail.asp"
End If

Set Rs = Nothing
Response.Redirect Request.Form("location")


I try debug with Response.Write Session("AdminLogin") and nothing shows....

0
Comment
Question by:CoolChi
  • 3
4 Comments
 

Author Comment

by:CoolChi
ID: 16797422
I have figure out why....seem like strPassWD is not equal to Rs("upass")

But I do have the same value on both.....can anyone tell me why is this happening?
0
 
LVL 7

Accepted Solution

by:
SimonBlake earned 2000 total points
ID: 16797432
What format on the DB is "upass", as the RS value might have trailing spaces... try wrapping it with Trim

ie. If Trim(strPassWD) = Trim(Rs("upass")) Then

Simon
0
 

Author Comment

by:CoolChi
ID: 16797439
Is it the problem with the data type on SQL Server?
The data type i m using for the upass column is nvarchar(16)
0
 

Author Comment

by:CoolChi
ID: 16797448
Thanks SimonBlake.....
Your solution is correct!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question