Admin Login Design (7th section) _ Practical Tips

Source: Internet
Author: User

This article implementation of the administrator login effect, when the user name and password is correct, pop-up login success prompts, or pop-up user name or password error prompts.
Today there are three major learning tasks:
Learning Task One understanding the definition of namespaces

Defined
Namespace Space Name
{
Class
}
Reference
Using Space name

Learning Task Two realizes the design of administrator landing interface
the interface layout is as shown in the figure:



Tip: When inserting a table, you should pay attention to the table size, layout, border, background settings, ready in advance, you can save the next work; the 2nd is to distinguish between image and ImageButton.

Learning Task three realization of login interface verification
Step 1: Use a Third-party control validation code control, download the. dll file to add to the Toolbox.
Step 2: In Visual Studio 2008, in the Solution Explorer panel, right-click the site and choose Add ASP.net folder to the bin command from the pop-up shortcut menu. In the pop-up dialog box, right-click the Bin folder, select the Add Reference command from the pop-up shortcut menu, and in the Add Reference dialog box, select the Browse tab, locate the WebValidates.dll file, and add it to the Bin folder.
Step 3: Drag and drop the control to the page.
Step 4: Write code to load the build 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)
  { C7/>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.t
      Rim ()) {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) (' username and password correct! ');
      </script> "); else {Response.Write <script>alert (' username or password incorrect! ');
   </script> "); } else {Response.Write (' <script>alert (' Authentication code Error! ');
    </script> "); } 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 is correct and the verification code is correct, pop-up login success prompt box, or pop-up username or password error box.

Run Effect chart:

Summarize
Through the study of this section, understand the meaning and role of namespaces, use the table layout to implement the administrator login interface design and the use of Third-party control validation Code control to implement the login interface verification.

Hope that the above content can be helpful to everyone's study.

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.