MVC Login Registration Page

Source: Internet
Author: User

(a) main function {controller} showing the page


Public classUcontroller:controller {// //GET:/u/ PublicActionResult Index () {returnView (); } Public ActionResult Xiugai (string UIDs, string pwd) {bool IsOK = new UBF (). Login (UIDS,PWD); if (IsOK) {//Save status session["UIDs"] = UIDs; Jump interface Return redirecttoaction ("Index", "Home"); } else {return redirecttoaction ("Index"); } } }}
(ii) function {model} modified in the database

Using System.Collections.Generic; using System.Linq; using system.web; namespace Job _ News management. models{ Publicclass UBF { private Newsdbdatacontext context = new Newsdbdatacontext (); public bool Login (string UIDs, string pwd) { var query = context.u.where (p = = P.uids = = UIDs && p.pwd ==PWD); return query. Count () > 0; } }

(iii) display of the interface {Iew}
@{Layout=NULL;}<! DOCTYPE html>"Viewport"Content="Width=device-width"/> <title>Index</title> } </div></body>

MVC Login Registration Page

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.