我有一个系统,其中所有页面(视图)和所有控件(按钮,链接,菜单itens ...)都应用了安全角色.
所以我有一个管理界面,其中所有页面和控件都已注册.每个用户都有一组个人权限.
所以,例如:
我有一个View EditCar,有3个按钮:"New","Delete"和"Back".
因此,用户X有权查看View EditCar,只有"Back"按钮
因此,必须注册每个新视图,并与用户相关联.没有角色,因为每个用户都是100%可配置的.
所以,我有一个FilterAttribute:
public class CustomAuthorize : FilterAttribute, IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext)
{
if (filterContext.HttpContext.Request.IsAuthenticated)
{
var userPermissions = repository.GetAll().Where(x => x.Name.Equals(User.Identity.Name);
// if (!userPermissions.Pages.Any(x => x.NamePage.Contains(???))))
}
else
{
filterContext.Result = new HttpUnauthorizedResult();
}
}
}
Run Code Online (Sandbox Code Playgroud)
所以我的问题是: - 我应该在数据库中保留什么来识别每个视图(动作)?也许3个值?区域控制器,行动?
这是最好的选择吗?有关该解决方案的任何其他想法
谢谢
新的Github HTML5和CSS3(HTML5历史API)树导航非常棒:https: //github.com/blog/760-the-tree-slider
他们使用哪个JQuery插件来执行UI幻灯片效果?或者类似的(Jquery Slide with Ajax loading)
谢谢
我正在使用该插件:https://github.com/plentz/jquery-maskmoney来格式化我的钱编辑器...
我尝试在该编辑器中使用KnockoutJS,但它不起作用......没有那个掩码一切正常......
我的代码测试很简单:
<input id="Price" data-bind="value: Price" type="text" name="Price">
Run Code Online (Sandbox Code Playgroud)
Javascript to Mask输入
$("#Price").maskMoney({ symbol: 'R$ ', showSymbol: true, thousands: '.', decimal: ',', symbolStay: false });
Run Code Online (Sandbox Code Playgroud)
和KnockoutJS
var ViewModel = function () {
this.Price = ko.observable();
this.PriceFinal= ko.computed(function () {
return this.Price()
}, this);
};
ko.applyBindings(new ViewModel());
Run Code Online (Sandbox Code Playgroud) 我有自定义身份验证,当用户登录时,我在Session/Cache上保留必要的信息...
所以,我有一些DropDowns的视图必须显示按用户ID过滤的数据...我想知道过滤该结果的最佳方法是什么...
1 - 直接在控制器上?
...
Model.MyList = repository.GetAll().Where(x => x.User.Id == userId);
return View(Model);
Run Code Online (Sandbox Code Playgroud)
2 - 创建动作过滤器(如何在不查询来自DB的不必要数据的情况下执行此操作)
3 - 其他方式?
1的问题是我有几个具有相同下拉列表的视图,因此我将不得不重复相同的代码.
我在RadWindow里面有一个RadGrid.我需要在客户端选择一个Radgrid行.
我怎样才能做到这一点?
我试图像这样得到radgrid:
var masterTable = $find("<%=radgridID.ClientID%>").get_masterTableView();
Run Code Online (Sandbox Code Playgroud)
但总是变空...
有帮助吗?
我有一个完整的系统在IIS 5.1工作...我迁移到IIS 7.0与管道模式经典一切正常,但与管道集成我的图像/ CSS没有加载...
我使用ASP.NET 3.5与Web应用程序...
有帮助吗?
使用身份验证与MVC有点迷失...
我正在寻找在大型电子商务网站中使用的最佳选择,其中性能是首要任务......
我现在看的两个选项是:
缓存身份验证数据,如下所示:
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
if (HttpContext.Current.User != null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
// Get Forms Identity From Current User
FormsIdentity id = FormsIdentity)HttpContext.Current.User.Identity;
// Create a custom Principal Instance and assign to Current User (with caching)
Customer principal = (Customer)HttpContext.Current.Cache.Get(id.Name);
if (principal == null)
{
// Create and populate your Principal object with the needed data and …Run Code Online (Sandbox Code Playgroud)我正在使用JQuery Unobtrusive验证...我使用Globalize配置接受这样的数字:1.500,50(由JQuery屏蔽)
我的代码到目前为止
1-)配置全球化
$.validator.methods.number = function (value, element) {
return this.optional(element) || !isNaN(Globalize.parseFloat(value));
};
$(function () {
Globalize.culture('pt-BR');
});
Run Code Online (Sandbox Code Playgroud)
2-)配置web.config
<globalization culture="pt-BR" uiCulture="pt-BR" />
Run Code Online (Sandbox Code Playgroud)
好的,所以我使用JQuery插件将Textbox格式化为Money(PT-BR):1.500.000,50 ...
我的JQuery客户端验证工作正常!但是当它进入服务器验证时,我得到了一个ModelState错误:
"The value '1.500.000,50' is not valid for Total."
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
谢谢
我已经创建了一个具有权限的虚拟目录(cgi-bin):Scripts和Executable ...当我测试:http://localhost/cgi-bin/mapserv.exe时,我收到404错误,找不到页面
我应该为.exe文件添加EXTENSION映射吗?可执行文件?
谢谢!
我按照关于导出Kendo网格数据的教程:http://www.kendoui.com/blogs/teamblog/posts/13-03-12/exporting_the_kendo_ui_grid_data_to_excel.aspx
现在我正在尝试导出所有数据(不仅仅是显示的页面)......我该怎么做?
我在尝试获取数据之前尝试更改pagezise:
grid.dataSource.pageSize(grid.dataSource.total());
Run Code Online (Sandbox Code Playgroud)
但随着我的实际网格刷新与新pageSize.这是一种在不刷新网格的情况下查询kendo数据源的方法吗?
谢谢
asp.net-mvc ×3
c# ×3
asp.net ×2
javascript ×2
cgi ×1
github ×1
iis ×1
iis-6 ×1
iis-7 ×1
jquery ×1
kendo-grid ×1
kendo-ui ×1
knockout.js ×1
telerik ×1