小编eye*_*snz的帖子

ASP.NET MVC 3区域和web.config中的多重身份验证

我一直在尝试关注此博客以使区域运作:

http://mstechkb.blogspot.com/2010/10/areas-in-aspnet-mvc-20.html

在博客文章中,它标识了为每个区域设置身份验证的能力,例如:

<location path="Area1">
  <system.web>
  <authentication mode="Windows" />
  <authorization> 
    <allow roles="role1,role2"/>
    <deny users="*"/> 
  </authorization> 
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试在Visual Studio 2010中的新项目中创建它时,运行时出现以下错误:

在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的.

从我可以看到这是因为你不能指定一个身份验证元素,除非它在顶级web.config中.

那么博客文章可以做什么呢?您是否可以在web.config中的Location元素中包含具有Authentication元素的区域?

authentication asp.net-mvc-3-areas asp.net-mvc-3

13
推荐指数
1
解决办法
4029
查看次数

嵌套的Linq Min()崩溃了Visual Studio

我有一段代码使Visual Studio 2008 IDE运行速度非常慢,占用大量内存,最终导致崩溃.我怀疑VS正在达到操作系统内存限制.

以下代码不是我真正的应用程序代码,但它模拟了问题.基本上我试图使用LINQ在树中找到最小值.

class LinqTest
{
    public class test
    {
        public int val;
        public List<test> Tests;
    }

    private void CrashMe()
    {
        test t = new test();

        //Uncomment this to cause the problem
        //var x = t.Tests.Min(c => c.Tests.Min(d => d.Tests.Min(e => e.Tests.Min(f=>f.Tests.Min(g=>g.Tests.Min(h => h.val))))));
    }
}
Run Code Online (Sandbox Code Playgroud)

有没有人见过类似的东西?

c# linq ide visual-studio-2008

12
推荐指数
1
解决办法
814
查看次数