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


i need a login page using session in classic asp

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
i need a page in asp to authiticate user name and password coded inside the asp page
and create a session then in the other pages i need to code to check if the session exists or not.
Question by:Co0L_DBA

Expert Comment

ID: 26291833
To start off you can use the Login control in VS 2008, this will authenticate the user login into the database. Also you create accoutn setups as well.

Checking if session exists : Would look at seeing to pass between the pages if the user is logged in or not using a session variable, or you can use the login view control from VS 2008..

Accepted Solution

djpazza earned 2000 total points
ID: 26292061
You should be able to get what you need from my example.
' Set Username and Password
uname = "admin"
pword = "password"

<% if request("username") = uname AND request("password") = pword then 
session("authuser") = "yes"
session("authuser") = "no"
end if
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<% if session("authuser") = "no" then %>
Please log in<br />
<% if request("check") <>"" then %>
Please check your details
<% end if%>
<form id="form1" name="form1" method="get" action="">
    <input type="text" name="username" id="uname" />
    <input type="text" name="password" id="pword" />
  <p><input name="check" type="hidden" value="check" />
      <input type="submit" name="button" id="button" value="Login" />
<% else %>
You have successfully logged in
<% end if %>

Open in new window


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

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