Can't write value into Session items

Posted on 2006-05-31
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")
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
    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....

Question by:CoolChi

    Author Comment

    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?
    LVL 7

    Accepted Solution

    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


    Author Comment

    Is it the problem with the data type on SQL Server?
    The data type i m using for the upass column is nvarchar(16)

    Author Comment

    Thanks SimonBlake.....
    Your solution is correct!

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    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 updat…
    SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    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…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now