【问题标题】:Securing the rss feed with username and password,for private viewing使用用户名和密码保护 rss 提要,供私人查看
【发布时间】:2010-03-10 03:42:57
【问题描述】:

如何保护 Rss 供稿以供私人查看?

【问题讨论】:

    标签: asp.net asp.net-mvc security rss feed


    【解决方案1】:

    您可以像保护任何其他文件一样通过 web.config 保护提要。大致如下:

    <configuration>
      <system.web>
        <authentication mode="Forms">
          <forms name=".AUTH" loginUrl="login.aspx" protection="All" timeout="60">
            <credentials passwordFormat="MD5">
              <user name="admin" password="" />
            </credentials>
          </forms>
        </authentication>
        <authorization>
          <allow users="?" />
          <allow users="*" />
        </authorization>
      </system.web>
    
      <location path="feed.xml">
        <system.web>
          <authorization>
            <allow users="admin" />
            <deny users="*" />
          </authorization> 
        </system.web>
      </location>
    </configuration>
    

    【讨论】:

      【解决方案2】:

      如果您有控制器操作并使用内置授权,则使用[Authorize] 属性装饰操作结果:

      [Authorize (Users="List of users", Roles="List of roles")]
      RssActionResult RssFeed(params)
      {
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-06-20
        • 2016-10-03
        • 2016-08-17
        • 2017-12-02
        • 1970-01-01
        • 2011-08-21
        相关资源
        最近更新 更多