asp.net 站点地图管理员查看用户看到的内容
我目前正在尝试找出如何最好地为我的应用程序实施管理方面。
我有一个用户网站,用户可以登录、自定义他们的个人资料、提交信息等。 我希望管理用户能够登录并能够从用户列表中进行选择。从那里,管理员可以像用户一样为用户提交信息。
Website Start Page > RogerRabbit > Submit Information
Website Start Page > BillyBob > Customize Profile
所以我的问题是:
- 我的页面应该如何布局?
- Web.sitemap 文件应该是什么样子?有没有一种很好的方法来创建站点地图(也许在内存中?)
- 此方法必须使用会话变量吗?
任何建议或提示都会很棒。
I am currently trying to figure out how to best go about implementing an administration side for my application.
I have a user site, where users can log in, customize their profile, submit information etc.
I would like administration users to be able to log in and be able to choose from a list of users. From there, the administrator can submit information for the user just like the user can.
Website Start Page > RogerRabbit > Submit Information
Website Start Page > BillyBob > Customize Profile
So my question is:
- How should my pages be laid out?
- How should the Web.sitemap file look? Is there a nice way of creating a sitemap (maybe in memory?)
- Would this method have to use session variables?
Any suggestions, or tips would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法回答您的站点地图问题,但我已经在我们的一个系统上实现了这样的解决方案,我可以通过模拟最终用户来准确地看到他们所看到的内容。我这样做主要是为了排除故障,这样当他们向我报告问题时(例如他们的视图中缺少某些内容),我可以像他们一样进入并准确了解他们在谈论什么。
我这样做的方法确实有点粗糙,是在我的数据库中有一个模拟表,其中包含正在模拟的用户的登录名以及他们希望模拟的用户的登录名。
我添加了一些覆盖代码,以便当用户第一次访问该页面(它使用 Windows 身份验证)时,它将检查该用户是否在表中设置了模拟,然后将此用户 ID 放入会话状态的对象中。如果没有模拟,它会将实际的用户 ID 放置在同一个对象中。
为了防止我像他们一样对用户数据进行操作,该对象中有两个属性,一个用于 logon_name,系统使用该属性进行内容自定义,另一个称为 NameForLog,在记录任何操作时使用。我所做的所有操作都将被记录为我。
网站上显示用户自定义内容的所有区域都会查看此会话对象,因此它们将始终使用模拟 ID,从而始终向我显示用户所看到的内容。除了第一页和日志代码之外,它甚至不知道它正在处理的是我。
这不是最干净的解决方案,但对我来说效果很好。
I can't answer your sitemap question but I have implemented a solution like this on one of our systems where I can see exactly what the end user is seeing by impersonating them. I did this mainly for troubleshooting purposes so that when they report a problem to me (such as something missing from their view), I can go in as them and see exactly what they are talking about.
The way I did this, which is admittedly a little crude, was to have an impersonation table in my database which contains the logon name of the user who is doing the impersonating and the logon of the user they wish to impersonate.
I added some override code so that when the user first goes to the page (it uses Windows authentication), it will check to see if that user has an impersonation set in the table and then place this user id in an object in the session state. If there was no impersonation, it would place the actual user id in this same object.
To prevent me from doing things to the user's data as them, there are two properties in this object, one for logon_name, which is what is used by the system for content-customization, and another called NameForLog, which is used when logging any actions. All actions I make will be logged as me.
All areas on the site that display user-customized content look at this session object, so they will always use the impersonated ID and therefore always show me what the user is seeing. Beyond the first page and the logging code, it doesn't even know that it is me it is dealing with.
It isn't the cleanest solution, but it has worked well for me.
我不知道迈克...这是一系列广泛的问题。有点像问“如何在 ASP.NET 中构建网站”。
听起来很像您需要投资一本涵盖这些主题领域的介绍性“asp.net 入门书籍”。好消息是,几乎每一本从初级到中级的 ASP.NET 书籍都可能涉及到这些主题领域的大部分内容。
这是一种模仿……而且比听起来要困难得多。但是如何做到这一点取决于您的应用程序如何验证用户、授权用户和管理角色...这是 asp.net 中的一个完整的子专业(实际上有它自己的专用书籍)。
小心?
这在 MSDN 相当详尽。是的,您可以在内存中创建站点地图。过去我曾多次根据 SQL 数据库中存储的数据创建站点地图,但我不知道从哪里开始解释它。您必须了解站点地图使用的基类和接口,然后创建一个适合您的数据和站点结构规则的自定义站点地图提供程序。
大概。大多数具有“登录用户”意识的站点都需要会话。并非普遍正确,但几乎如此。
I dunno mike... that's a broad set of questions there. Kinda like asking "how to I build a web site in asp.net".
It sounds very much like you need to invest in an introductory "how-to asp.net book" that covers these topic areas. The good news is that just about every beginner to intermediate asp.net book ever written probably hits most of these topic areas.
This is a kind of impersonation... and is a lot harder than it sounds. But how you do this depends on how your application authenticates users, authorizes users, and manages roles... which is a whole sub-specialty within asp.net (with it's own dedicated books actually).
Carefully?
This is covered on MSDN quite thouroughly. Yes, you can create your sitemaps in memory. I've created sitemaps from data stored in a SQL DB a few times in the past, but I'd have no idea where to even start to explain it. You have to understand the base classes and interfaces used by sitemaps and then make a custom sitemap provider adapted to working with your data and rules for the site's structure.
Probably. Most sites with an awareness of "logged in user" need sessions. Not universally true, but nearly so.