用户模拟ASP.NET窗体身份验证

时间:2021-10-15 08:06:15

Scenario: In an e-commerce system, a helpdesk user should be able to "impersonate" or "log on as" a specific customer (from the web-based administration site) so that he can support the customer first-hand - eg. when the Customer is on the phone.

场景:在电子商务系统中,服务台用户应该能够“模仿”或“登录”特定客户(来自基于Web的管理站点),以便他可以直接支持客户 - 例如。当客户打电话时。

Additional clarification: There is no need to keep track of the original authentication context. We simply need to provide a "Log on as" button that will log on as the customer without the helpdesk user needing to know the password.

补充说明:无需跟踪原始身份验证上下文。我们只需要提供一个“登录为”按钮,该按钮将作为客户登录,而不需要帮助台用户知道密码。

Any ideas how this scenario could be implemented using regular ASP.NET Forms Authentication?

有关如何使用常规ASP.NET窗体身份验证实现此方案的任何想法?

2 个解决方案

#1


Maybee I don't understand the scenario exactly. But why not let the support login as the user?

也许我完全不理解这个场景。但为什么不让支持登录为用户?

FormsAuthentication.SetAuthCookie("yourCustomersUserName");

Then it will be up to the e-commerce system to have an updated "cart" or whatever so the support can help..

然后,电子商务系统将有一个更新的“购物车”或其他任何支持可以帮助..

#2


I was able to get this to work, assuming you've got a user already logged in, you can impersonate another user with the below code.

我能够让这个工作,假设你有一个用户已经登录,你可以用下面的代码冒充另一个用户。

FormsAuthentication.SignOut();

FormsAuthentication.SetAuthCookie("username", true );

#1


Maybee I don't understand the scenario exactly. But why not let the support login as the user?

也许我完全不理解这个场景。但为什么不让支持登录为用户?

FormsAuthentication.SetAuthCookie("yourCustomersUserName");

Then it will be up to the e-commerce system to have an updated "cart" or whatever so the support can help..

然后,电子商务系统将有一个更新的“购物车”或其他任何支持可以帮助..

#2


I was able to get this to work, assuming you've got a user already logged in, you can impersonate another user with the below code.

我能够让这个工作,假设你有一个用户已经登录,你可以用下面的代码冒充另一个用户。

FormsAuthentication.SignOut();

FormsAuthentication.SetAuthCookie("username", true );