权限管理页面控制(3)
来源:未知 责任编辑:责任编辑 发表时间:2015-01-01 13:18 点击:次
bool isProtectedResource(string page)
{
page = page.ToLower();
System.Collections.Generic.List<String> protectedFiles =
new System.Collections.Generic.List<string>(); //受保护资源的扩展名
protectedFiles.AddRange(new string[] { ".aspx", ".asmx", ".ashx" });
string found=protectedFiles.Find(s => page.EndsWith(s));
if (found == null)
return false;
ApplicationModule module = SJL.Bll.UserRight.ApplicationModuleBLL.getByUrl(page);
if (module == null) return false;
return !module.IsPublic; //如果页面为公共模块则不受保护
}
#endregion
public void OnLogRequest(Object source, EventArgs e)
{
//可以在此放置自定义日志记录逻辑
}
}
Web.coinfig中配置下
<httpModules>
<add name="CheckUserModule" type="SJL.Web.HttpCode.CheckUserModule"/>
</httpModules>
先判断是否登录,是否是受保护的资源,然后根据url来判断是否有权限访问!
摘自 双魂人生
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>
今日头条
更多>>您可能感兴趣的文章
- 向Excel文档中嵌入VBA控件和UserForm并显示
- ASP.net页面中请求远程Web站点
- 步步为营 SharePoint 开发学习笔记系列&nb
- 用OpenXml在文档的尾部添加一个Rich Text Content Con
- Spring.Net学习系列一: 统一异常处理
- ASP.NET之Gridview图解(1)
- ASP.NET生成高质量缩略图通用函数(c#代码)
- Request.Cookies 和 Response.Cookies 的区别
- 使用ASP.NET MVC3+EF+Jquery制作文字直播系统(一
- ASP.NET FormsAuthentication跨站点登录时绝对地址返



