简体   繁体   English

从FormsAuthentication重定向到登录页面时,在Post中维护变量

[英]Maintain variables in Post when redirected to login page from FormsAuthentication

Here is our scenario: 这是我们的场景:

  1. A user logs into web site #1. 用户登录网站#1。 Once authenticated, the site gethers some credentials about the user (a separate process that has nothing to do with this question) and POSTS this information to a page on web site #2 经过身份验证后,该网站会获得一些有关用户的凭据(与此问题无关的单独流程),并将此信息发送到网站#2上的页面
  2. Web site #2 is protected by FormsAuthentication and redirects the user to the Login page. Web站点#2受FormsAuthentication保护,并将用户重定向到“登录”页面。
  3. At this point, the values that were posted by web site #1 are lost. 此时,网站#1发布的值将丢失。

Question: 题:

How do we preserve the posted values from web site #1 during the authentication/login process in web site #2. 我们如何在网站#2中的身份验证/登录过程中保留网站#1中发布的值。

Things we have tried: 我们尝试过的事情:

  1. We attempted to put code into the Session_Start method in Global.asmx. 我们尝试将代码放入Global.asmx中的Session_Start方法。 We wanted to save the values in session, but the session only starts (the breakpoint is hit) when the user is redirected to the Login page. 我们希望在会话中保存值,但是当用户重定向到“登录”页面时,会话才会启动(断点被点击)。 By this time, we have already lost the values. 到这个时候,我们已经失去了价值观。
  2. We tried putting some code into Application_BeginRequest, but cannot access session from that method. 我们尝试将一些代码放入Application_BeginRequest,但无法从该方法访问会话。

We need to use POST rather than GET because the length of the data is too long to put in the querystring. 我们需要使用POST而不是GET,因为数据的长度太长而无法放入查询字符串。 Same reason why we cannot preserve the values in a cookie. 我们无法保留cookie中的值的原因相同。

Can you keep track of anything (some kind of arbitrary session identifier, like a guid) throughout the steps? 你可以在整个步骤中跟踪任何事物(某种任意会话标识符,如guid)吗? I would consider storing the credentials gathered in a database until step 3 is reached, and then destroying the record when the login takes place. 我会考虑存储在数据库中收集的凭据,直到达到步骤3,然后在登录时销毁记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 FormsAuthentication重定向到登录页面 - FormsAuthentication redirecting to login page 访问网站的根目录时,FormsAuthentication重定向到登录页面 - FormsAuthentication redirecting to login page when visiting root of website 从intuit重定向时自动登录网站 - auto login to website when redirected from intuit ASP.NET中FormsAuthentication的登录页面问题 - Login page issue with FormsAuthentication in asp.net 重定向到登录页面时,asp.net/iis 不附加 ReturnUrl - asp.net/iis is NOT appending a ReturnUrl when redirected to login page 登录页面未正确重定向 - Login Page not getting redirected properly 阻止页面或处理程序更新 FormsAuthentication 票证 - Prevent a page or handler from updating the FormsAuthentication ticket 在FormsAuthentication对用户进行身份验证之后,撤消身份验证并重定向到登录页面 - Revoking authentication and redirect to login page after FormsAuthentication have authenticated the user WebForms FormsAuthentication - 身份验证后重定向导致登录页面再次调用 - WebForms FormsAuthentication - Redirect after authentication results in Login Page to be called again FormsAuthentication 访问被拒绝的 ASP.NET 应用程序中的登录页面 - Login Page in ASP.NET application with FormsAuthentication access denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM