Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the administrator login design

Shulou Source: shulou.com Published: 2022-06-03 08:55:23 09月12日 Update

This article introduces the relevant knowledge of "how to realize the administrator login design". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Learning task 1 to understand the definition of namespaces

Define

Namespace space name

{

Class

}

Quote

Using space name

Learning task 2 to realize the design of administrator login interface

The layout of the interface is shown in the figure:

Tip: when inserting a table, you should pay attention to the size, layout, border, background settings of the table, ready in advance, you can save the next work; the second point is to distinguish between image and imagebutton.

Learning task 3 to realize the verification of login interface

Step 1: use the third-party control CAPTCHA control to download the .dll file and add it to the toolbox.

Step 2: in the solution Explorer panel of Visual Studio 2008, right-click the site and select add ASP.NET folder to the Bin command from the pop-up shortcut menu. Right-click "Bin folder" in the pop-up dialog box, select "add reference" command in the pop-up shortcut menu, select "Browse" tab in the pop-up "add reference" dialog box, locate the WebValidates.dll file and add it to the Bin folder.

Step 3: drag and drop controls to the page.

Step 4: write code to load and generate CAPTCHA for the first time. The code is as follows:

Public partial class _ Default: System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {if (! IsPostBack) {SnCode.Create ();}}

Step 5: double-click the Login button to add the following code to the adminlogin.aspx.cs code page:

Public partial class admin_adminlogin: System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {if (! IsPostBack) {SnCode.Create ();}} protected void ImageButton6_Click (object sender, ImageClickEventArgs e) {if (SnCode.CheckSN (TextBox3.Text.Trim)) {String username = TextBox1.Text; String userpwd = TextBox2.Text; users user1 = null; user1 = new users () User1.Admin = username; user1.Pwd = userpwd; DataSet ds1 = new userschuli (). Adminlogin (user1); DataTable dt = ds1.Tables [0]; if (dt.Rows.Count > 0) {Response.Write ("alert ('username and password is correct!');} else {Response.Write (" alert ('username or password is incorrect!'); ") }} else {Response.Write ("alert ('CAPTCHA error!');");}} protected void ImageButton5_Click (object sender, ImageClickEventArgs e) {TextBox1.Text = "; TextBox2.Text ="; TextBox3.Text =";}}

Step 6: run the debugging code, when the user name and password are correct and the verification code is correct, the login success prompt box pops up, otherwise the username or password error prompt box pops up.

Run the effect diagram:

This is the end of the content of "how to implement the administrator login design". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Steps code files authentication login administration password user user name administrator design task control folder interface space learning prompt select next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL macOS NVidia Shulou Tech Info Linux