本文介绍了如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们在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.
更多推荐
如果我们在网址中键入特定的页面名称,则应将其重定向到登录页面
发布评论