ASP - Creating a protected section
- Server with IIS (Internet Information Service) installed;
- File creation. Mdb (Access format) to usernames and passwords of authorized users;
- Session variables;
- The Global.asa file;
- The # include statement;
How many times have you thought about how to protect access to certain pages of your sites?
Now your wish can come true, by following this simple tutorial, created by myself in a simple and intuitive.
First we create the Global.asa file to be included in the root directory of our site, this file is retrieved from the server each time a user accesses the site through the browser (eg Netscape or Explorer), and executes the code in it content in the functions Application_OnStart () and Session_OnStart ().
But if we close the browser window and then abandon the site will run the code inside the functions Session_OnEnd () and Application_OnStart ().
Not necessarily have to be present all four functions within the file, it depends on the needs of the programmer to use them all, some, or none.
The following is added to the code to enter if we wanted to protect some of our pages:
| 1. <SCRIPT Language=vbscript runat=server> 2. Sub Session_OnStart () 3. Session ("flag") = 0 4. Session.Timeout = 40 5. End Sub 6. Sub Session_OnEnd () 7. Session ("flag") = 0 8. End Sub 9. </ SCRIPT> |











Recent Comments