1.数据库里面查的结果

2 vs里面查的结果   为什么 不是16 而是2

下面是代码

/// <summary>
/// 权限检查
/// </summary>
public class checkPermission : AuthorizeAttribute
{
AliexpressEntities aliexpressEntities = new AliexpressEntities();
public override void OnAuthorization(AuthorizationContext filterContext)
{
HttpContextBase context = filterContext.HttpContext;
var url = "/login";

if (context.Session["user"] == null)
{
context.Response.Write(string.Format("<script> window.top.location.href='{0}';</script>", url));
}
else
{
var user = context.Session["user"] as YH_User;
string Controller = null;
string action = null;
if ( filterContext.ParentActionViewContext!=null) //部分试图
{
action= filterContext.ParentActionViewContext.RouteData.Values["action"].ToString().ToLower();
Controller = filterContext.ParentActionViewContext.RouteData.Values["controller"].ToString().ToLower();

}
else
{
Controller = (filterContext.ActionDescriptor).ControllerDescriptor.ControllerName.ToLower();
action = filterContext.ActionDescriptor.ActionName.ToLower();
}

var role = aliexpressEntities.SYS_User_Role.Where(p => p.isActive == true && p.UserId == user.userId).Single();

//这里获取不到最新的数据

//所属角色下所有的权限
var IsSystemModel = aliexpressEntities.SYS_SystemModel.Where(p => p.isActive == true && aliexpressEntities.SYS_Role_Permissions.Where(M => M.isActive == true && M.RoleId == role.RoleId).Select(M => M.SystemModelId).Contains(p.SystemModelId) && p.Controllers.ToLower() == Controller && p.Action.ToLower() == action).FirstOrDefault();
if (IsSystemModel==null)
{
context.Response.Write(string.Format("<script> window.top.location.href='{0}';</script>", url));
}

}

}
}

求大神解答

最新文章

  1. 在php中使用strace、gdb、tcpdump调试工具
  2. margin:0 auto 与 text-align:center
  3. SSE and Websocket
  4. sharepoint2010问卷调查(2)-实现问卷的图片调查(采用自定义字段类型)
  5. Jenkins遇到问题三:调整jdk版本不生效的解决办法
  6. Ubuntu小点汇总,更新中...
  7. (spring-第15回【IoC基础篇】)容器事件
  8. Hashset,Iterator
  9. LA 5059 (找规律 SG函数) Playing With Stones
  10. js 自己容易搞混的笔记查询
  11. 1671: [Usaco2005 Dec]Knights of Ni 骑士
  12. Java基础——多态
  13. linux_网站计量单位
  14. bzoj4487[Jsoi2015]染色问题 容斥+组合
  15. Java中的String为什么是不可变的? -- String源码分析
  16. leetcode 890. 查找和替换模式 Python
  17. springboot shiro开启注释
  18. ACM-ICPC 2018 沈阳赛区网络预赛 J Ka Chang
  19. 转载:centos安装redis
  20. $\mathcal{Friends&#39; \ \ Links}$友情链接

热门文章

  1. 函数式C代码
  2. [原创]零基础R语言教程---第二课---R语言入门
  3. android获取sdk更新
  4. POJ 2986 A Triangle and a Circle
  5. (DP)House Robber
  6. 【LeetCode练习题】Recover Binary Search Tree
  7. HDU 1576 A/B(数论)
  8. POJ 3046 Ant Counting DP
  9. spring3 jsp页面使用&lt;form:form modelAttribute=&quot;xxxx&quot; action=&quot;xxxx&quot;&gt;报错,附连接数据库的spring MVC annotation 案例
  10. boost格式化输出xml