Jump to content

Putting a password


Guest NeDizZ

Recommended Posts

I wanted to ask how do I put a password to my website? I mean when someone comes and wants to access some part of the website, has to type a password first. Then only the people, who to I tell the password, can access.I think it is java scripting, if not, sorry for flood.Sorry for bad english, I hope you understand.

Link to comment
Share on other sites

Actually search this forum first - you'll find this entry:http://w3schools.invisionzone.com/index.php?showtopic=1017Trying to password protect your site with javascript is like telling a thief you locked your car but the keys are on top of the driver side tire.Javascript is a client-side language which means that the code resides on the client PC and the code gets executed there too. So, if you have logic built that protect a page, allI have to do is look through your code (reverse engineer it) and I'll find out how to get in.You will have to use one of two (or both) methods:a.) server side scripting language (php, asp, cold fusion)b.) server directory services (pasword protect at operating system level)

Link to comment
Share on other sites

It is actually quite easy.You need a login form and when it is submited you save the login state to a session variable. Then on each page you check the state of the session variable.If it is good you let them proceed if not you redirect them to the login page.ASP.Net uses Forms Authentication, which is a bit more complicated but much more solid.

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...