bootstrap+angularjs+mvc3+ Paging Technology + role Authorization verification system

Source: Internet
Author: User

Page usage Code:

<script src= "@Url. Content (" ~/content/bootstrap/js/bootstrap.min.js ")" ></script> < link href= "@ Url.content ("~/content/bootstrap/css/bootstrap.min.css") "rel=" stylesheet "media=" screen "/>2.angularjs< Script src= "@Url. Content (" ~/scripts/angular.min.js ") ></script>

<script type= "Text/javascript" >

var app = Angular.module ("ControlState", []); App.controller ("Home/login",function ($scope, $window) {$scope. Login =function (user) {var url=The @Url. Action ("Login"," Home")"; $.post (Url,user,function (ret) {if (ret=="False") {art.dialog.tips (' User name or password is wrong, please re-enter! ‘,1.5); $(' Form ') [0].reset (); $(' Form input ') [0].focus (); }else{if (user. username== "Index";                         else                              location=

3.page OutPublic ActionResult MessageBox (Int?id) {int pageid=1;if (ID. HasValue) {Pageid=id.             Value; }var list=dbfactory.getentities<message> (MessageTable.MessageToUserID.Equal (Systemglobaldata.current_ USERID).             and (MessageTable.Deleted.Equal (0))); var count=dbfactory.getint32count (MessageTable.MessageToUserID.Equal (Systemglobaldata.current_userid).             and (MessageTable.Deleted.Equal (0)));             pagedlist<message> plist=New pagedlist<message> (List,pageid,5);         return View (pList); }

Front-end Code

View Code

4. Permissions role Validation

Using System;Using System.Collections.Generic;Using System.Linq;Using System.Web;Using SYSTEM.WEB.MVC;Using System.Xml.Linq;
Using Moon.orm;Using Mynorthdb;
Namespace Razor.moon {///<summary>///Description of Checkloginattribute.///</summary> PublicClass Custemerauthenattribute:authorizeattribute {PublicNewString[] Actionroles {GetSet }ProtectedOverrideBOOL Authorizecore (HttpContextBase HttpContext) {if (HttpContext = =NULL) {ThrowNew ArgumentNullException ("HttpContext"); }if (!httpcontext.user.identity.isauthenticated) {ReturnFalse }if (Actionroles = =NULL) {ReturnTrue }if (actionroles.length = =0) {ReturnTrue }if (Actionroles.contains (HttpContext.User.Identity.Name)) {ReturnTrue }ReturnFalse }ProtectedOverridevoid Handleunauthorizedrequest (AuthorizationContext filtercontext) {var request=filtercontext.httpcontext.request;String url=request.url.scheme+"://"+request.url.authority+"/home/login"; Filtercontext.result =New Redirectresult (URL); }PublicOverridevoid Onauthorization (System.Web.Mvc.AuthorizationContext filtercontext) {string controllername = FilterContext.ActionDescriptor.ControllerDescriptor.ControllerName;string actionname = FilterContext.ActionDescriptor.ActionName;String roles = Actionrolemanager.getactionroles (ActionName, controllername);if (! String. Isnullorwhitespace (roles)) {this . actionroles = roles.             Split (new string[] { ","}, Stringsplitoptions.removeemptyentries); } base.         Onauthorization (Filtercontext); }     } }5.

6. Project Download

http://files.cnblogs.com/humble/%E9%A1%B9%E7%9B%AE%E5%8F%8A%E6%95%B0%E6%8D%AE%E5%BA%93.7z

Http://www.cnblogs.com/humble/p/3149734.html

bootstrap+angularjs+mvc3+ Paging Technology + role Authorization verification system

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.