Administrator Login design (section 7th), Administrator Login section 7th

Source: Internet
Author: User

Administrator Login design (section 7th), Administrator Login section 7th

This article provides an Administrator Logon result. If the user name and password are correct, the logon success prompt is displayed. Otherwise, the user name or Password error prompt is displayed.
Today we have three major learning tasks:
Learning Task 1 understand the definition of namespaces

Definition
Namespace name
{
Class
}
Reference
Using space name

Learning Task 2: design the Administrator Logon Interface
Specific interface layout:



TIPS: when inserting a table, you should pay attention to the table size, layout, border, and background settings, and make preparations in advance to save the next work. The second point is to distinguish between image and imagebutton.

Study Task 3 to verify the logon Interface
Step 1: Use the third-party control Verification code control to download the. dll file and add it to the toolbox.
Step 2: in Visual Studio 2008's Solution Explorer panel, right-click the site and select Add ASP. NET folder to Bin from the shortcut menu. In the displayed dialog box, right-click "Bin folder" and select the "add reference" command in the shortcut menu. In the displayed "add reference" dialog box, select the "Browse" tab, find WebValidates. dll file and add it to the Bin folder.
Step 3: Drag and Drop controls to the page.
Step 4: Compile the code to load and generate the Verification Code 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 and add the following code in 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 ("<script> alert ('user name and password are correct! '); </Script> ") ;}else {Response. Write (" <script> alert ('user name or password is incorrect! '); </Script> ") ;}} else {Response. Write (" <script> alert ('verification code error! '); </Script> ") ;}} protected void ImageButton5_Click (object sender, ImageClickEventArgs e) {TextBox1.Text =" "; TextBox2.Text =" "; TextBox3.Text = "";}}

Step 6: run the debugging code. If the user name and password are correct and the verification code is correct, a prompt box Indicating Successful Logon is displayed. Otherwise, a prompt box Indicating incorrect user name or password is displayed.

Run:

Summary
This section describes how to understand the meaning and functions of a namespace, use table layout to design the Administrator Logon interface, and use a third-party control Verification code control to verify the logon interface.

I hope the above content will be helpful for your learning.

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.