Spark 显示登录用户

发布于 2024-09-01 12:17:37 字数 237 浏览 0 评论 0 原文

如何显示 Spark 视图中登录者的用户名?

默认的 MVC 视图引擎有一个 Page 对象,您可以从中获取信息。

我将如何在火花中做到这一点?

我知道我可以将信息放入 viewdata 字典中,这可能是最好的,但我不想

ViewData["User"] = myUser;

在从每个操作方法返回之前都必须写入。

我想要一些反馈

How do I show the username of the person logged in within a Spark View?

The default MVC view engine had a Page object that you could get the info from.

How would I do that in spark?

I know that I could put the info into the viewdata dictionary, which is probably the best, but I don't want to have to write

ViewData["User"] = myUser;

before I return from EVERY action method.

I'd like some feedback

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

余生共白头 2024-09-08 12:17:37

感谢您让我再次查看属性。

找到了用户对象

Context.User

我在Spark 视图中 。它没有页面对象,但它确实有我需要的东西。 :)

Thanks for making me look at the properties again.

I found the user object in

Context.User

within the Spark View. It doesn't have a page object, but it does have what I need. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文