如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面

编程入门 行业动态 更新时间:2024-10-23 06:25:14
本文介绍了如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

推荐答案

实施会员资格 [ ^ ],然后在文件夹中设置适当的访问权限Web.Config文件: 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.

更多推荐

如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面

本文发布于:2023-05-25 17:02:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/315090.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   将其   则应   重定向   名称

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!