【问题标题】:How to secure a simple asp.net web application?如何保护一个简单的 asp.net Web 应用程序?
【发布时间】:2015-03-30 09:20:57
【问题描述】:

我有一个简单的 .net Web 应用程序。我的目标是从登录页面开始。注册成功后,用户应该可以访问网站的真实内容。有些链接应该能够在注册后但不能在注册之前访问。我正在为此工作几天,在互联网上找不到任何东西。

【问题讨论】:

    标签: asp.net login


    【解决方案1】:

    使用Use the ASP.NET Membership Provider

    不要使用Session 自行滚动。它将是vulnerable to attacks such as session fixation

    话虽如此,但确实有一些缺陷,例如it does not clear the server side of sessions after logout

    这将使您能够使用authorization rules in web.config

    <location path="AdminFolder">
    <system.web>
    
    <authorization>
    <allow roles="Admin"/> //Allows users in Admin role
    
    <deny users="*"/> // deny everyone else
    </authorization>
    
    </system.web>
    </location>
    

    【讨论】:

      【解决方案2】:

      注册成功后将页面重定向到真实内容,如果用户未登录,则将会话设置为内容页面重定向回登录或注册页面

      /*set session in  content page this will prevent the direct access to 
               content    page */ 
      if(Session['success]==null){
      redirect to login or signup page ;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-06-28
        • 1970-01-01
        • 2010-12-15
        • 2021-05-17
        • 2014-01-29
        • 2015-03-31
        相关资源
        最近更新 更多