小编MVC*_*ble的帖子

ASP.NET MVC中的ServiceStack.NET Windows身份验证(NTLM)

如何在ASP.NET MVC4上构建的ServiceStack项目中实现Windows身份验证?

我开始使用添加的全局请求过滤器AppHost:

private void ConfigureAuth(Funq.Container container)
{
    this.RequestFilters.Add((httpReq, httpResp, requestDto) =>
    {
        var user = HttpContext.Current.User.Identity;
        if (!user.IsAuthenticated ||
            !user.Name.Contains(_myTestUser)) //todo: check username here in database (custom logic) if it has access to the application
            httpResp.ReturnAuthRequired();
    });
}
Run Code Online (Sandbox Code Playgroud)

这将打开一个登录对话框,如果输入正确(用户名存在且输入了有效密码,并且myTestUser设置为此密码),则会产生成功的响应.如果有任何错误,将再次显示登录对话框. - 这对我来说听起来不错.但在第二个登录窗口中重新输入正确的用户后,它将停止工作.该对话框再次打开,如果它再次不正确.过滤器函数内没有遇到断点.

知道是什么原因引起的吗?

这就是我在web.config中添加的内容:

<authentication mode="Windows"/>
<authorization>
  <deny users="?" /> <!--only allow authenticated users-->
</authorization>
Run Code Online (Sandbox Code Playgroud)

我想完全锁定网站并仅使用其特定权限(角色)启用对数据库中指定Windows用户的访问.我需要实现自定义逻辑来访问"用户和角色列表".也许在MVC4/ASP.NET中有另一种方法可以做到这一点?

c# windows-authentication servicestack asp.net-mvc-4

20
推荐指数
1
解决办法
8257
查看次数

如何以编程方式更新ui-grid中的排序指标?

我正在使用ui-grid-v3.0.0-rc.22-2015-06-15。

它配置为使用外部排序,效果很好。

现在,我需要使用选择框从外部更改已排序的列。选择框的每次更改都会触发外部排序,并且网格中的数据会正确更新。它还更新了gridOptions.columnDefs:将除正确列之外的所有列的排序对象设置为undefined,并更新已排序的列。

但是有一个问题,当前排序的列指示符(在列标题中)没有得到应有的更新。

我尝试使用带有“ options”或“ column”作为参数值的gridApi.core.notifyDataChange(),但是它也不起作用。如何以编程方式更新ui-grid中的排序指标?

这是由选择框触发的部分代码:

    function updateSortColumn() {
        if ($rootScope.QuickSearch.sortBy !== undefined) {
            $scope.gridOptions.columnDefs.forEach(function (col) {
                if (col.field === $rootScope.QuickSearch.sortBy) {
                    col.sort = {
                        direction:  $rootScope.QuickSearch.sortOrder,
                        priority: 0
                    };
                }
                else
                {
                    col.sort = undefined;
                }
            });
        }
        if($scope.gridApi !== undefined)
        {
            $scope.gridApi.core.notifyDataChange( uiGridConstants.dataChange.OPTIONS );
            $scope.gridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
        }
    }
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-grid

3
推荐指数
1
解决办法
4118
查看次数