模拟在ASP.NET中的成员资格用户 [英] Impersonate a membership user in ASP.NET

查看:197
本文介绍了模拟在ASP.NET中的成员资格用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个通用的 asp.net 的网站成员角色和散列的口令启用,我想提供模拟的管理者,使他们可以浏览网站,的用户一样。该网站应该作为如果该用户登录,然后才能恢复到自己的登录。

什么是实现这一目标的最佳方法?

一个例子用例:有两种类型的用户的网站:买家和管理。 该网站提供了一个购买按钮购买由管理员给用户明确规定的东西。即只有买家可以使用购买按钮,进行付款。 用户有麻烦所以支持管理员可以'冒充'用户的登录和购买代其或看到他们所面临的困难。

如果没有模拟,唯一的办法就是让这code和否定看到用户的问题的目的。不,即使我没有使用散列密码,并使用 FormsAuthentication.SignOut()键,手动记录在管理员的用户。

我希望我上面的决策意识。

解决方案

看看这个样本中的codeproject.com。我认为它,你要寻找的。

In a generic asp.net website with Membership, Roles and hashed passwords enabled, I would like to provide the administrators with impersonation so that they may browse the website as that user would. The website should function as if that user is logged on and then be able to revert to their own login.

What is the best approach to achieve this?

An example use-case: A website with two types of users: 'Buyer' and 'Admin'. The website provides a 'Purchase' button to buy something specifically provided to the user by the admins. i.e only that buyer can use the purchase button and make a payment. User has trouble so a support admin can 'impersonate' the user's login and purchase on their behalf or 'see' the trouble they are facing.

Without impersonation, the only way is to allow this in code and that negates the purpose of 'seeing the user's issue'. Not even if I was not using hashed passwords and had used FormsAuthentication.SignOut() and manually logged in the admin as the user.

I hope i am making sense above.

解决方案

Take a look at this sample on codeproject.com. I think it does what you're looking for.

这篇关于模拟在ASP.NET中的成员资格用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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