Jump to content

Password Protected


damini_dd

Recommended Posts

Hello FriendsI am new to ASP. I am developing one application having links to many ASP pages. But my application starts with login page. If i enter valid user name and password then it opens a ASP page with various buttons for different activities. But my problem is I don't allow anyone to directly execute my any asp page just typing path of that ASP page in address bar. If they directly try to execute any other ASP source without entering username and password it should nt allow. Plz help me soon.Thanksdamini

Link to comment
Share on other sites

Hi damini,When a user logs in with a correct login and password then you can assign him a session (default time 20 minutes). Then, on the top of each of your asp pages you should put an include file called for e.g. validate_user.aspIn that file you will verify if the user that is trying to open any page of your site, has an active session, if it's not the case then your redirect him to the default.asp. Got it?Here is the explanation concerning the session object : http://www.w3schools.com/asp/asp_sessions.aspIn your validate_user.asp file you can put something like :

<%If Len(Trim(session("userID"))) <= 0 Then    Response.Redirect ("../default.asp")End If%>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...