如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面 [英] If we type the specific page name in the url address it should be redirected to login page

查看:110
本文介绍了如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在URL地址中键入特定的页面名称时,例如http://localhost//sample/sapmle.aspx,不应显示指定的页面,而应仅将其重定向到登录页面.

When we type a specific page name in the url address,for example http://localhost//sample/sapmle.aspx the specified page should not be displayed it should be redirected to login page only.

推荐答案

实施会员资格 [
Implement Membership[^] in your website, and set the appropriate access in the folders Web.Config file:
<configuration>
    <system.web>
        <authorization>
            <allow roles="Admin" />
            <allow roles="User" />
            <deny users="*" />
        </authorization>
    </system.web>
</configuration>


使用
Request.UrlReferrer


使用web.config文件中的Aathentication标记,并将登录页面的登录网址设置为

use Aathentication tag in web.config file and set theloginurl to the login page as

<authentication mode="Forms">
      
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>



此设置可让匿名用户重定向到登录页面.



this setting lets anonymous users to redirect to the login page.


这篇关于如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆