FormsAuthentication:在浏览器中键入URL时,我仍然能够访问登录页面以外的页面 [英] FormsAuthentication: i still able to access a page other than login page when type the URL in a browser

查看:88
本文介绍了FormsAuthentication:在浏览器中键入URL时,我仍然能够访问登录页面以外的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只允许经过身份验证的用户访问页面.我使用FormsAuthenticates机制.但是,当我键入登录页面以外的页面的url时,我仍然可以查看它.我希望它重定向到登录页面但这不是我得到的.请帮助我

I want to allow only authenticated user to acces a pages.I use the FormsAuthenticates mechanism.However when i type the url of a pages other than login page i still able to view it.I expect it to redirect to a login page but that not what i got.Please help me

推荐答案

如果您要访问的页面在子文件夹中.然后,确保子文件夹中有一个web.config文件.现在,在此Web.config文件中.写下面的代码.拒绝用户=?"在该web.config文件中.
If the pages which you are trying to access are in subfolders. Then make sure that there is a web.config file in the subfolder. Now, In this Web.config file. Write below code. deny users="?" in that web.config file.


怎么说您的网站已启用表单身份验证?

您能否发布用于启用表单身份验证的web.config部分?

这是一个例子,

How do say you forms authentication is enabled for your web site?

Could you please post the portion of web.config that you use to enable forms authentication?

Here is an example,

<authentication mode="Forms">
  <forms name="yourCookieName"  cookieless="UseUri" loginUrl="Login.aspx" protection="All" timeout="90" slidingExpiration="true"/>
</authentication>
<authorization>
  <deny users="?" />      
</authorization>



拒绝标记中的?"表示拒绝匿名用户访问该网站.



Here ''?'' in deny tag denies anonymous users from accessing the site.


这篇关于FormsAuthentication:在浏览器中键入URL时,我仍然能够访问登录页面以外的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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