如何保护简单的 asp.net Web 应用程序?

How to secure a simple asp.net web application?

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

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

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

使用Use the ASP.NET Membership Provider.

不要使用 Session 自己滚动。它将是 .

话虽这么说,但它确实存在一些缺陷,例如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>