表格认证 [英] Forms Authentication

查看:75
本文介绍了表格认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上使用FormsAuthentication.当用户在未经身份验证的情况下请求页面时,他们将被重定向到登录页面.验证使用后,用户将被重定向到请求的页面.我希望应用程序始终重定向到默认页面,而不是所请求的页面.这太多了吗?

这是我的web.config:

I am using FormsAuthentication in my website. When a user requests a page while they are not authenticated, they are redirected to the login page. Once the use is authenticated, the user is redirected to the requested page. I would like the application to ALWAYS redirect to the default page, not the requested page. Is this too much to ask?

Here''s my web.config:

<authentication mode="Forms">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" defaultUrl="Default.aspx" />
</authentication>




这是我在登录页面上的身份验证代码:




Here''s my authentication code from the login page:

FormsAuthentication.RedirectFromLoginPage(employeeID, true);



我想念什么?谢谢!



What am I missing?? Thanks!

推荐答案

您是否正在使用登录控件?如果是这样,请处理LoggedIn事件并根据需要重定向
Are you using the Login control? If so, handle the LoggedIn event and redirect as necessary


这篇关于表格认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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