![]() |
![]() |
||||||||||||||||
|
ASPLogin
Documentation Contents
You may uninstall ASPLogin Pro using the Add/Remove Programs control panel. Preparing your web project Make sure that every HTML document you wish to protect with ASPLogin has the extension .asp, not .htm or .html. If you use a site management package, such as Microsoft FrontPage, you should be able to rename your files without breaking any links. Your web server must be configured so that all the documents that you with to protect reside under one server root which has both read and execute or read and script permission.The ASPLogin installer should have placed a copy of asplogin.asp and aspldeny.asp in your web server root. If it did not, or if you are setting up ASPLogin on a new virtual server, just make a copy of these files from the ASPLogin Program Files directory. You may edit asplogin.asp and aspldeny.asp to match your site. Be sure, however, not to modify any of the ASP code in asplogin.asp before <HTML> or between <!--ASPLogin form begins--> and <!--ASPLogin form ends-->.ASPLogin will display an "invalid login" message on the login page if a user inputs a user name/password combination that is not in the database. You may customize the "invalid login" message by setting Session("asplLoginError") in global.asa (more on global.asa below). This is particularly useful for sites are not written in English. If you are using ASPLogin Pro, you may also want to have specific documents for users whose accounts have expired or are inactive. To use these features, create HTML or ASP files for your expired and or inactive user pages and place them under your web server root. You will have to set session variables with the path to these files (see global.asa, below). If you do not set these extra files up, ASPLogin will just send expired or inactive users to aspldeny.asp by default. Enabling protection for your documents Each Asp file that will be protected by ASPLogin must have a small piece of ASP code at the start of the file - before any other HTML or server-side scripting. Microsoft ASP uses VBScript by default, however an example is also provided in JScript. The very top of your Asp files should read: <%@ LANGUAGE=VBScript %>Or, in JScript: <%@LANGUAGE=JScript%>By placing this code on your Asp files, users will automatically be sent to the login page (asplogin.asp) the first time they access one of the Asp files. After logging in, they will be able to go to any protected page without having to log in again during their site session. If they come back at a later date, they will be presented with the login page once again, regardless of which page they access first.To manually log a user out of your site, they need to access a page containing the ASP script: <% Session.Abandon %>User, group and date expiration settings can be added in each document with the following directives, placed between the Server.CreateObject and Protect lines: asplObj.Group("GroupName")asplObj.User("UserName")asplObj.LastDate("1/1/2001")For example, to make a document available to all users in a group called 'management', members of a group called 'administrators' and a user called 'fred' (who may or may not be in either of the groups), you would add the following code to the top of the document: <%@ LANGUAGE=VBScript %>Note: Group and date permissions work only in ASPLogin Pro and will be ignored in the freeware version. Additional ASPL.Login object methods An ASPL.Login object can also call the method asplObj.ResetPermissionwhich clears all user, group and lastDate directives already set on the current page. This is useful only when you are running conditional permission code. Most ASPLogin installations will never use asplObj.ResetPermission.Finally, ASPL.Login objects have a DebugInfo method which returns the version number and debugging information. Setting up the user database and login forms in global.asa ASPLogin Pro comes with a pre-made MS Access format user database. ASPLogin must be able to find your database. If you have installed ASPLogin in the default location, the pre-made database is located at C:\Program Files\ASPLogin\asplogin.mdb on your server's hard disk.If you installed to another location, or plan to use a different data source such as MS SQL Server, you must set ASP session variables to tell ASPLogin where to find the database, and what the table and column schema is (if different from the default).The best place to set this information is in the file 'global.asa' in the root level of your site. An example global.asa is shown below. <SCRIPT LANGUAGE=VBScript RUNAT=Server>This example file sets the Session("asplConnStr") variable to point to an access database installed at C:\users.mdbOther ASPLogin session variables are available for changing the table and field names that ASPLogin uses to authenticate users and check group permissions. You only need to set these if you do not use the pre-made database, and you only need to set them once per session, as above. There are also session variables for the locations of documents to direct users to if their account is expired, if an error occurred with the login, etc. The complete set of ASPLogin settings session variables is in the following table: |
|||||||||||||||||
| Session Variable | What it sets | ||||||||||||||||
| asplUserTbl | name of the table with user info | ||||||||||||||||
| asplGroupTbl | name of the table with group names | ||||||||||||||||
| asplMemberTbl | name of table that maps users to groups | ||||||||||||||||
| asplUserTbluserid | autonumber or identity field for users | ||||||||||||||||
| asplUserTblusername | field with user name | ||||||||||||||||
| asplUserTblpassword | field with password | ||||||||||||||||
| asplUserTblactive | boolean (yes/no) for whether the user is active | ||||||||||||||||
| asplUserTblexpires | last date that the user can log in | ||||||||||||||||
| asplGroupTblgroupid | autonumber or identity field for groups | ||||||||||||||||
| asplGroupTblgroupname | field with group name | ||||||||||||||||
| asplMemberTbluserid | field in member table for userid | ||||||||||||||||
| asplMemberTblgroupid | field in member table for groupid | ||||||||||||||||
| Session("asplFormPath") | Path to asplogin.asp if not in the web server root | ||||||||||||||||
| Session("asplDenyPath") | Path to aspldeny.asp if not in the web server root | ||||||||||||||||
| Session("asplInactivePath") | Path to page for inactive users (default is aspldeny.asp) | ||||||||||||||||
| Session("asplExpiredPath") | Path to page for expired users (default is aspldeny.asp) | ||||||||||||||||
| Session("asplLogPath") | Windows path to user log file | ||||||||||||||||
| Session("asplLoginError") | Error message to display when incorrect password or unknown user name is entered in asplogin.asp | ||||||||||||||||
| Session("asplErrorPath") | Path to page for database errors during login (default prints a text message to the browser) | ||||||||||||||||
|
Web-based administration The the web-based administration utility is installed by default as /aspladmn.asp under your web root. The administration utility is protected by ASPLogin like any other page in your site. Access to the administrator is initially restricted to the default user 'Admin', with the password 'Admin' in the ASPLogin pre-made database. You should change this user's password immediately when you first run the web administrator. Note that ASPLogin passwords are case sensitiveThe web based administrator will let you add, edit and delete users and groups in your ASPLogin database. In addition, you can enter your registration information into the 'settings' tab to activate the Pro features. Using ASPLogin with virtual servers Follow the following steps to enable ASPLogin with more than one virtual server:
Who's logged in? ASPLogin sets the session variables Session("asplUserName") and Session("asplUserID") with the name and id number of the current logged in user. You can use these variables in your own ASP scripts to customize your site content for different users. User activation and expiration (Pro only) The active field of the ASPLogin Pro database (or any boolean or yes/no field in your own database) can be used to indicate whether users are permitted to log in to the site. If the active field is set to TRUE or YES then a user's login will be accepted. If the field is FALSE or NO, the user will be sent to aspldeny.asp. Alternatively, you can set the session variable Session("asplInactivePath") to an alternate file for inactive users. The active field is useful for situations where users sign up, but then must wait until their credit card has been charged or other information has been received to access your protected pages.Similarly, you may want certain users to only be able to access the site for a certain period of time. The expiration field allows you to set a date limit on any given account, after which they will not be able to log in. Just like the active field, if a user name has expired, the user will be sent to aspldeny.asp unless the session variable Session("asplExpiredPath") has been set to an alternate destination for expired users (such as a page to renew their membership).User Logging (Pro only)ASPLogin Pro can keep a log file of all the users who access protected files. ASPLogin Pro does not perform logging by default. To activate this feature, define the session variable Session("asplLogPath") in your global.asa file. The variable should contain the full windows path to the log file. If the file does not exist, it will be created. For example: Session("asplLogPath")="C:\temp\asplogin_logfile.txt" The log file
is in W3C Extended Log File format, with the username substituted for
the URL. This makes it easy to run the log files through many standard
web access statistics packages to determine the number of logins, who
logs on the most, when logins occur, etc. |
|||||||||||||||||
| Using the ASPL.Login object in an ASP page
|
|||||||||||||||||
| Create an ASPLogin object to protect this document | |||||||||||||||||
| set asplObj=Server.CreateObject("ASPL.Login") | |||||||||||||||||
| asplObj.User("<username>") | Restrict access to this .asp document to the user "<username>" | ||||||||||||||||
| asplObj.Group("<groupname>") | Restrict access to this .asp document to the group "<groupname>" | ||||||||||||||||
| asplObj.LastDate("<mm/dd/yyyy>") | Deny access to this page after "<mm/dd/yyyy>" | ||||||||||||||||
| asplObj.Protect | Protect this page | ||||||||||||||||
| asplObj.ResetPermission | Reset any user, group and date permission set already | ||||||||||||||||
| asplObj.DebugInfo | Print out settings and debugging information | ||||||||||||||||
| Other ASP useful in your documents | |||||||||||||||||
| Session("asplUserName") | The username field for the currently logged in user | ||||||||||||||||
| Session("asplUserID") | The userid field for the currently logged in user | ||||||||||||||||
| Session.Abandon | Resets the ASP session and logs out the current user | ||||||||||||||||
| ASPLogin session variables to (optionally) be set in global.asa
|
|||||||||||||||||
| Session("asplConnStr") | The connection string or DSN name for the ASPLogin database | ||||||||||||||||
| Session("asplUserTbl") | name of the table with user info | ||||||||||||||||
| Session("asplGroupTbl") | name of the table with group names | ||||||||||||||||
| Session("asplMemberTbl") | name of table that maps users to groups | ||||||||||||||||
| Session("asplUserTbluserid") | autonumber or identity field for users | ||||||||||||||||
| Session("asplUserTblusername") | field with user name | ||||||||||||||||
| Session("asplUserTblpassword") | field with password | ||||||||||||||||
| Session("asplUserTblactive") | boolean (yes/no) for whether the user is active | ||||||||||||||||
| Session("asplUserTblexpires") | last date that the user can log in | ||||||||||||||||
| Session("asplGroupTblgroupid") | autonumber or identity field for groups | ||||||||||||||||
| Session("asplGroupTblgroupname") | field with group name | ||||||||||||||||
| Session("asplMemberTbluserid") | field in member table for userid | ||||||||||||||||
| Session("asplMemberTblgroupid") | field in member table for groupid | ||||||||||||||||
| Session("asplFormPath") | Path to asplogin.asp if not in the web server root | ||||||||||||||||
| Session("asplDenyPath") | Path to aspldeny.asp if not in the web server root | ||||||||||||||||
| Session("asplInactivePath") | Path to page for inactive users (default is aspldeny.asp) | ||||||||||||||||
| Session("asplExpiredPath") | Path to page for expired users (default is aspldeny.asp) | ||||||||||||||||
| Session("asplLogPath") | Windows path to user log file | ||||||||||||||||
| Session("asplLoginError") | |||||||||||||||||
| Error message to display when incorrect password or unknown user name is entered in asplogin.asp | |||||||||||||||||
| Session("asplErrorPath") | |||||||||||||||||
| Path to page for database errors during login (default prints a text message to the browser) | |||||||||||||||||
|
|||||||||||||||||