Link to home
Start Free TrialLog in
Avatar of malik_mumtaz
malik_mumtaz

asked on

Login and password dialog

I want to use dialog for login and password in asp.How i can do it.
Avatar of xabi
xabi

Hi there:

You must create an login page with a form where you must ask for the login an the password:

..
..
<form name="myform" action="login2.asp" method="post">
Login:<input type="text" name="login">
<br>
Pass:<input type="password" name="password">
</form>
..
..


Then you must create a page "login2.asp" where you must get the values submitted from the previous page this way:

..
..
<%
login=request.form("login")
password=request.form("password")
%>
..
..

now you have the values of the login and password and you must check is this values are correct (using a database query or simply checking this values with a predefined values. If the values passwed are oke then make something like this:

..
..
if login="my_user" and password="my_password" then
  session("user_logged")="ok"
  response.redirect("first_page.asp")
else
  session("user_logged")="no"
  response.redirect("error.asp")
end
..
..

This will redirect to the right page depending on the correct values. In every page you must first chec if the user is logged this way:

..
..
is session("user_logged")<>"ok" then
  response.redirect("login.asp")
end if
..
..

If you have any problem just ask

xabi
Avatar of malik_mumtaz

ASKER

Sorry I have used this technique but
I want to call browser authentication dialog.
Under Windows NT, in Windows Explorer, right-click at the file or directory you want to protect. Select Security, Permissions. Delete User "Everyone", and select the user you want to allow access. Give him the right to "read" or whatever is useful.

Before, possibly create that user in the User Manager.

Under Unix, there is a .htaccess file, but I don't know what to do there.

- But I assume, your site is hosted by an external provider. So tell them which directory to protect, and which name and password to use. If you're paying enough money, he will follow your command ;-)
ASKER CERTIFIED SOLUTION
Avatar of jamestthomas
jamestthomas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have a database.Where user are added
by registration online.I want to call win NT security dialog through asp pages.It is possible or not.
Those people can register on line but they still must be placed into the group allowed access to the site in order for my answer to be applicable.
If you are talking registering and immediate access, you will want to use Microsoft Site Server.  That product is designed for allowing registered users into a particular site.
Please explain about site server.
Microsoft Site Server is a large E commerce product produced to help companies offer sites that allow for registration of users online.  It also granulates user levels of authority so that users can opt for certain levels of membership and this level is enforced within the site.  It essentially works with SQL server which is not recommended to be installed on the same machine as the server.  Microsoft will have alot of literature online about it so I would recommend going their and doing research.  It is a complicated product but very powerful.  If you are in need of what it offers, it can be great.