Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:27:46+00:00 2026-06-03T22:27:46+00:00

Its a simple login form that I have made using Classic ASP, where the

  • 0

Its a simple login form that I have made using Classic ASP, where the user and the admin can login using the same form.

In the “Users” table in database I have created a field called “status” with DATA TYPE as BIT(i.e “0” or “1”) value is accepted. By default value is “0” for every new registered user.

I have passed a query where if the status is “0” that particular User or Admin should be redirected to Authentication.asp page where he’ll answer some questions and onclick of SUBMIT the status value in the database will be set to “1”.
“1” indicates that user or admin has filled the authentication form and can be redirected to his desired page rather then redirecting him to Authentication.asp page.
For that I have used If-elseif-else statement. I rechecked it many times it doesn’t seem that there is any thing missing with my if-else statements. But I’m always redirected to authentication page even if I manually entered “1” as the status in the status column in database. here’s my code.

Session("Username")=request.form("user_name")
    if request.Form("sub_but") <> "" then
    sql = "SELECT * FROM Users WHERE UserName='"&request.form("user_name")&"' AND Password='"&request.form("pwd")&"'"
    rs.open sql, con, 1, 2  
    if rs.EOF then
            response.Write("<script language='javascript'>{attention_emp();}</script>")
        else
        if(rs("status")=1 & rs("login_type")="admin") then
                  Response.Redirect ("admin.asp")
        elseif(rs("status")=1 & rs("login_type")="emp") then
                      response.Redirect("leave.asp")
        else
                      response.Redirect("auth.asp") 
        end if  
    end if

    rs.close
    end if 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:27:50+00:00Added an answer on June 3, 2026 at 10:27 pm

    Do not use “&” use the following:

    if(rs("status")=1 AND LCase(rs("login_type"))="admin") then
                  Response.Redirect ("admin.asp")
        elseif(rs("status")=1 AND LCase(rs("login_type"))="emp") then
                      response.Redirect("leave.asp")
        else
                      response.Redirect("auth.asp") 
        end if  
    

    In vbScript “&” is a string concatenation operator not a logical operator. Here is a list of vbScript operators.

    EDIT also note that string comparisons are case sensitive. I’ve changed the comparison to convert the database output to lower case. This could also be a factor in your problem.

    Also take note of @Mirko comment!!!

    EDIT 2 To Clarify from comments

    If you are still always getting redirected to the authentication page the actual cause needs to be determined. Hard coding the conditional statement should help rule it out as being the cause. Another method for debugging is to pull apart the statement instead of redirecting. See below:

    if(rs("status")=1 AND LCase(rs("login_type"))="admin") then
        Response.Redirect ("admin.asp")
    elseif(rs("status")=1 AND LCase(rs("login_type"))="emp") then
        response.Redirect("leave.asp")
    else
        Response.Write "Status: " & rs("status") & "<br />"
        Response.Write "Is Status 1: " & (rs("status")=1)  & "<br />"
        Response.Write "Login Type: " & rs("login_type") & "<br />"
        Response.Write "Is Login Type admin: " & (rs("login_type") = "admin") & "<br />"
        Response.Write "Is Login Type emp: " & (rs("login_type") = "emp") & "<br />"
    end if  
    

    This will help you determine what is true and what is false in you if and if/else statements. Once you have done that is should become clearer as to what is causing the behavior you are getting. Once you have isolated and fixed the problem, put back the redirect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple login form, username and password. Basically, When a user is
I have a simple PHP form that sends an email to its visitors from
I have a form where an user can post a global notice into the
I have a simple web form that sends and email out via .NET C#.
I have a simple email form written in ASP.NET with the logic in the
I' trying to create a simple login form where users should be able to
Well, I have a simple question, at least I hope its simple. I was
I'm developing a desktop Mac OS X App that saves its very simple data
How to run javascript/Jquery functions on user specific time scenario its so simple when
I have a class CollectionOfThings . As its name suggests its a simple collection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.