简体   繁体   English

Page_Load事件中的Response.Redirect

[英]Response.Redirect in Page_Load Event

If Response.Redirect("/") is called during Page_Load event, a malicious user could have access to the contents of the page (before the redirect), like the html itself? 如果在Page_Load事件期间调用Response.Redirect(“ /”),那么恶意用户是否可以访问页面内容(在重定向之前),就像html本身一样? I'm trying to redirect unallowed users to default.aspx page, but I'm not sure if there are vulnerabilities using the code this way. 我试图将不允许的用户重定向到default.aspx页,但是我不确定使用这种方式的代码是否存在漏洞。

Place your page in a secure folder such as Members. 将您的页面放在一个安全的文件夹中,例如,Members。

In that folder add the following web.config file. 在该文件夹中,添加以下web.config文件。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>
</configuration>

Now only authenticated users will be able to get to that page. 现在,只有经过身份验证的用户才能访问该页面。

不用担心,只要将其放在活动开始就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM