ASP. NET logon interface: user verification code and. net Logon Interface

Source: Internet
Author: User
Tags asp net

ASP. NET logon interface: user verification code and. net Logon Interface

// ASP. NET user logon interface often uses the Verification Code as follows: private void Page_Load (object sender, System. eventArgs e) {// place the user code here to initialize the Label4.Text = RandomNum (4);} public string RandomNum (int n) // {string strchar =, 4, 5, 6, 7, 8, 9 "; string [] VcArray = strchar. split (','); string VNum = ""; // The StringBuilder int temp =-1 is not required because the string is short; // records the last random value, avoid generating several identical Random numbers. // use a simple algorithm to ensure that different Random numbers are generated. rand = new Random (); for (int I = 1; I <n + 1; I ++) {if (temp! =-1) {rand = new Random (I * temp * unchecked (int) DateTime. now. ticks);} // int t = rand. next (35); int t = rand. next (10); if (temp! =-1 & temp = t) {return RndNum (n);} temp = t; VNum + = VcArray [t];} return VNum; // return the generated random number} // ''function name: RndNum //'' function parameter: VCodeNum -- set the number of digits returned to the random string // ''function: generate random string private string RndNum (int VcodeNum) {string Vchar = ", A, B, C, D, E, f, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, W, X, Y, Z "; string [] VcArray = Vchar. split (",". toCharArray (); // generates an array string VNum = ""; int I; for (I = 1; I <VcodeNum; I ++) {System. random ro = new Random (); double decA = ro. nextDouble (); VNum = VNum + VcArray [Convert. toInt32 (35 * decA)];} // For I = 1 to VcodeNum // Randomize // VNum = VNum & VcArray (Int (35 * Rnd )) ''array is generally read from 0, so 35 * Rnd // Next return VNum;} // ASP.. NET login interface, user verification code, network collection and testing

 


How can I implement the user verification code on the ASP NET logon interface?

// ASP. NET user logon interface often uses the Verification Code as follows: private void Page_Load (object sender, System. eventArgs e) {// place the user code here to initialize the Label4.Text = RandomNum (4);} public string RandomNum (int n) // {string strchar =, 4, 5, 6, 7, 8, 9 "; string [] VcArray = strchar. split (','); string VNum = ""; // The StringBuilder int temp =-1 is not required because the string is short; // records the last random value, avoid generating several identical Random numbers. // use a simple algorithm to ensure that different Random numbers are generated. rand = new Random (); for (int I = 1; I <n + 1; I ++) {if (temp! =-1) {rand = new Random (I * temp * unchecked (int) DateTime. now. ticks);} // int t = rand. next (35); int t = rand. next (10); if (temp! =-1 & temp = t) {return RndNum (n);} temp = t; VNum + = VcArray [t];} return VNum; // return the generated random number} // ''function name: RndNum //'' function parameter: VCodeNum -- set the number of digits returned to the random string // ''function: generate random string private string RndNum (int VcodeNum) {string Vchar = ", A, B, C, D, E, f, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, W, X, Y, Z "; string [] VcArray = Vchar. split (",". toCharArray (); // generates an array string VNum = ""; int I; for (I = 1; I

Asp User Logon interface code

Login. asp:
<Form name = "login" method = "post" action = "after_login.asp">
Username: <input name = "user_name" size = "12" maxlength = "16"> password: <input name = "password" size = "12" type = "password" maxlength = "16">
<Input align = "absMiddle" id = "image1" name = "image1" src = "images/login.gif" type = "image" WIDTH = "37" HEIGHT = "20">
</Form>

Coon. asp:
<%
Connstr = "DBQ =" + server. mappathuser. mdb ") +"; DRIVER = {Microsoft Access Driver (*. mdb )}"
Set conn = Server. createobject ("ADODB. CONNECTION ")
Conn. Open connstr
%>

+ After_login.asp logon verification page:
<! -- # Include file = "Conn. Asp" -->
<%
Dim UserName, PassWord
UserName = replace (trim (Request. Form ("Username ")),"'","'")
PassWord = replace (trim (Request. Form ("PassWord ")),"'","'")

If UserName = "" or PassWord = "" Then
Response. Write ("<script> alert ('Member login failed! \ N error cause: the member account and password are not filled. '); History. back (); </script> ")
Response. end
End If

If Instr (UserName, ">")> 0 or Instr (UserName, "<")> 0 or Instr (UserName, "=")> 0 or Instr (UserName, "%")> 0 or Instr (UserName, chr (32)> 0 or Instr (UserName ,"? ")> 0 or Instr (UserName," & amp; ...... remaining full text & gt;>

Related Article

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.