2012-03-09 38 views
0

我设置​​到我的网站。<Loaction>在web.config中不起作用

我想允许进入登录页面

  1. ?是匿名的,*是每个人。有什么不同?

  2. 我加<location>web.config。那里的订单有关系吗?

    <configuration> 
        <configSections> 
        <section name="hibernate-configuration" 
          type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /> 
        <section name="log4net" 
          type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> 
        </configSections> 
        <appSettings> 
        <add key="webpages:Version" value="1.0.0.0" /> 
        <add key="ClientValidationEnabled" value="true" /> 
        <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
        </appSettings> 
        <location path="~/Authentication.htm"> 
        <system.web> 
         <authorization> 
         <deny users="*" /> 
         </authorization> 
        </system.web> 
        </location> 
        <location path="~/Resources"> 
        <system.web> 
         <authorization> 
         <deny users="*" /> 
         </authorization> 
        </system.web> 
        </location> 
        <location path="~/js"> 
        <system.web> 
         <authorization> 
         <deny users="*" /> 
         </authorization> 
        </system.web> 
        </location> 
        <location path="~/Images"> 
        <system.web> 
         <authorization> 
         <deny users="*" /> 
         </authorization> 
        </system.web> 
        </location> 
        <location path="~/Controllers"> 
        <system.web> 
         <authorization> 
         <deny users="*" /> 
         </authorization> 
        </system.web> 
        </location> 
        <system.web> 
        <compilation debug="true" targetFramework="4.0"> 
         <assemblies> 
         ..... 
         </assemblies> 
        </compilation> 
        <authentication mode="Forms"> 
         <forms name="Login" loginUrl="~/Authentication.htm" 
          protection="All" path="/" timeout="30" /> 
        </authentication> 
        <authorization> 
         <deny users ="?" /> 
         <allow users = "*" /> 
        </authorization> 
    

为什么我仍然得到验证错误,因为我已经加入到<location>的路径?

Authentication.htm?ReturnUrl=%2fResources%2fScripts%2fjquery-1.7.1.min.js:1Uncaught SyntaxError: Unexpected token <

Authentication.htm?ReturnUrl=%2fjs%2fCommon.js:1Uncaught SyntaxError: Unexpected token <

Authentication.htm?ReturnUrl=%2fjs%2fAuthentication.js:1Uncaught SyntaxError: Unexpected token <

+1

你在哪里加位置标签?该文件的顺序和结构绝对重要。 – 2012-03-09 10:58:01

+0

我错过了我的帖子中的qout,所以我的webconfig变得透明。修改 – 2012-03-09 11:00:35

+0

@EladBenda:是的,这有点麻烦 - 如果你碰巧在编号(或项目符号)列表中有代码或配置,你需要用8(而不是4)个字符来使代码格式化...... 。 – 2012-03-09 11:06:40

回答

0
  1. 之间的区别? (匿名)和*(所有人)是*包括所有匿名用户和其他用户,而?只包括尚未登录的用户。
+0

谢谢。你能帮助第二名吗? – 2012-03-09 11:45:07

相关问题