如何在asp .net 3.5中设置表单身份验证?
当我复制 URL 并粘贴到其他浏览器中时,页面会打开,但这是不应该发生的。这表明缺乏安全感。我想要表单身份验证。怎么做呢?
When I copy my URL and paste in other browser, the page opens which should not happen. This shows lack of security. I want the forms authentication. How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您在
web.config
文件中设置cookieless="true"
(或UseDeviceProfile
并且浏览器禁用了 Cookie),身份验证信息附加到 URL 中,并且此 URL 将在其他浏览器中有效。如果您使用cookie来识别用户,则只有当前浏览器才会对用户进行身份验证。If you set
cookieless="true"
(orUseDeviceProfile
and browser has cookies disabled) in yourweb.config
file, authentication information is appended to the URL and this url will be valid across other browsers. If you use cookies to identify users, then only the current browser will have the user authenticated.您需要在
web.config
文件中进行设置:如 这篇 MSDN 文章。
You need to set this up in your
web.config
file:As described in this MSDN article.
表单身份验证并不是 asp.net 3.5 中新添加的概念。它是从 asp.net 1.0 开始就存在的经过尝试和测试的技术。有很多书籍和教程可以向您展示如何做到这一点。实现此目的的最简单方法是使用成员资格提供程序模型,例如 SqlMembershipProvider。模型为您提供现成的基础设施,可用于身份验证。
Forms Authentication is not a newly added concept in asp.net 3.5. It is tried and tested technique in existence from asp.net 1.0. There are lot of books and tutorials available to show you how to do this. The simplest way you can achieve this is using membership provider models such as SqlMembershipProvider. Models provide you ready-made infrastructure which you can use for authentication.