<strike id="5ntnv"><i id="5ntnv"><del id="5ntnv"></del></i></strike>
<strike id="5ntnv"></strike><ruby id="5ntnv"></ruby><del id="5ntnv"><dl id="5ntnv"><del id="5ntnv"></del></dl></del><strike id="5ntnv"><dl id="5ntnv"><del id="5ntnv"></del></dl></strike>
<strike id="5ntnv"></strike>
<strike id="5ntnv"></strike>
<span id="5ntnv"><dl id="5ntnv"></dl></span>
<strike id="5ntnv"><i id="5ntnv"><del id="5ntnv"></del></i></strike><th id="5ntnv"><noframes id="5ntnv"><span id="5ntnv"><dl id="5ntnv"><del id="5ntnv"></del></dl></span>
<span id="5ntnv"></span>
<strike id="5ntnv"><dl id="5ntnv"><del id="5ntnv"></del></dl></strike>
<strike id="5ntnv"><dl id="5ntnv"><del id="5ntnv"></del></dl></strike><strike id="5ntnv"><i id="5ntnv"></i></strike><span id="5ntnv"></span>
<strike id="5ntnv"></strike>
<strike id="5ntnv"></strike>
<th id="5ntnv"><noframes id="5ntnv">
<ruby id="5ntnv"></ruby>
<strike id="5ntnv"><dl id="5ntnv"></dl></strike>

貴州網站建設公司貴州網站建設公司

Bootstrap+angularjs+MVC3+分頁技術+角色權限驗證系統

1.Bootstrap使用教程

相關教程: http://www.bootcss.com/components.html

頁面使用代碼:

<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= "@Url.Action("Login ","Home ")";
            
           $.post(url,user, function(ret){
                    if(ret== "False"){
                   art.dialog.tips( '用戶名或密碼錯誤,請重新輸入!',術角色權  1.5);
                   $( 'form')[ 0].reset();  
                   $( 'form input')[ 0].focus();
                                 
                       
                   } else{
                        if(user.UserName== "admin")
                           location= "Index";
                        else
                           location= "Contact";
                   }
           }); 
        };
         
    });

3.分頁

public 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 );
        }

前端代碼

Bootstrap+angularjs+MVC3+分頁技術+角色權限驗證系統 _ JavaClub全棧架構師技術筆記View Code


4.權限角色驗證

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>
     public  class CustemerAuthenAttribute:AuthorizeAttribute
    {
         public  new  string[] ActionRoles {   get;  set; }
         protected  override  bool AuthorizeCore(HttpContextBase httpContext)
        {
             if (httpContext ==  null) {
                 throw  new ArgumentNullException( " HttpContext ");
            }
             if (!httpContext.User.Identity.IsAuthenticated) {
                 return  false;
            }
             if (ActionRoles ==  null) {
                 return  true;
            }
             if (ActionRoles.Length ==  0)
            {
                 return  true;
            }
             if (ActionRoles.Contains(httpContext.User.Identity.Name))
            {
                 return  true;
            }
             return  false;
        }
         protected  override  void HandleUnauthorizedRequest(AuthorizationContext filterContext)
        {
             var  Request=filterContext.HttpContext.Request;
             string url=Request.Url.Scheme+ " :// "+Request.Url.Authority+ " /Home/Login ";
            filterContext.Result =  new RedirectResult(url);
        }
         public  override  void 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.效果圖

Bootstrap+angularjs+MVC3+分頁技術+角色權限驗證系統 _ JavaClub全棧架構師技術筆記

6.項目下載

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




少俠,我看你氣度不凡天賦異稟,骨骼精奇,這么帥,來了就幫推薦一把吧




我的最近更新 最新發布文章、框架、限驗咨詢等,證系來看看吧

作者:[秦時明月]
來源鏈接:https://www.cnblogs.com/thinkingmore/p/3149734.html

贊(8)
未經允許不得轉載:>貴州網站建設公司 » Bootstrap+angularjs+MVC3+分頁技術+角色權限驗證系統
国产欧美精品