Using ASP to realize the access of Web page divided user rights

Source: Internet
Author: User
ASP access to Web page split-user rights
Author: Gan Ganping
 
The problem arises
A few days before the Internet, see a netizen in the Computer forum ASP version of the following questions: "I tried to use ASP method for the Web page set the password, but
It is the user who knows the file name of the next link, you can enter the file name in the address bar and bypass the password file to browse the file directly.
How to achieve True
The purpose of positive encryption: If you do not enter the password, user name can not browse the Web page? ”
The question above is one aspect that is often involved in developing Web applications in a internet/intranet based network. For ASP-developed
Application, according to personal experience, to solve the above problems, there are generally 2 ways, the details are as follows:
Routine description
For illustrative purposes, the following methods are assumed to address the following examples:
Server IP address 192.188.188.188; Open a virtual directory on the server:/mytest, all test files are located under this path;
The primary file is myindex.asp, the user's primary login file is mylogin.asp, the test's legal user name is mytest, and the password is mytest.
Workaround 1
-Write mylogin.asp Content
  
<%@ language=vbscipt% >
< @Response. buffer=true% >
< HTML >< Head >< title > User Login </title >< BODY >
<%
If Request ("username") = "mytest" and Request ("password") = "MyTest" Then
Response.Redirect "Myindex.asp"
End If
% >
< font style= "font-size:11pt" > Please enter login username and password "</font >< br >
< form action= "mylogin.asp" method= "POST" >
< br > User name:< input type=text name= "username" >
< br > User password:< input type=password name= "password" >
< br >< input type=submit value= "Login" >
</form >
</body >-Write an ASP include file named Myrefer.asp
  
<%@ language=vbscipt% >
< @Response. buffer=true% >
<%
Myvaild=instr (LCase ("Http_referer"), "Http://192.188.188.188/mytest")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.