MVC 3 FormsAuthentication RedirectUrl 和 OpenID
我有一个名为 SignIn 的视图,其中包含两个用于身份验证的部分视图。一个用于 OpenID,另一个用于使用内部帐户登录我的网站。
OpenID 表单的操作转到 OpenIDSignIn() 操作,而另一个操作仅指向 SignIn()。一切都很好,除了当用户单击指向需要登录 [Authorize] 等的视图的链接时。
我在 QueryString 中看到了 returnUrl,但是由于以下事实,该值不可用于当前控制器操作他们将使用 OpenID 或正常登录,从而调用与这两个视图中的任何一个关联的 ActionResult。
只是为了澄清,returnUrl 是从 FormsAuthentication 中抛出的 URL,并在执行 RedirectFromLoginPage 等时使用。
I have one View called SignIn that contains two partial views for authentication. One is for OpenID and the other is for logging in to my site using an internal account.
The Action for the OpenID form goes to an OpenIDSignIn() Action while the other just points to SignIn(). Everything works great except for when a user clicks a link to a view that requires them to be logged on [Authorize] etc..
I see the returnUrl in the QueryString however this value is not available to the current controller action, due to the fact that they will be either be logging in with OpenID or normally, thus caling the ActionResult associated with either of those views.
Just for clarification the returnUrl is the one that gets thrown in there from FormsAuthentication and is used when doing a RedirectFromLoginPage etc..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个可行的解决方法。但是我讨厌会话变量!
This seems to be a viable workaround. However I hate session variables!