Spark 显示登录用户
如何显示 Spark 视图中登录者的用户名?
默认的 MVC 视图引擎有一个 Page 对象,您可以从中获取信息。
我将如何在火花中做到这一点?
我知道我可以将信息放入 viewdata 字典中,这可能是最好的,但我不想
ViewData["User"] = myUser;
在从每个操作方法返回之前都必须写入。
我想要一些反馈
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢您让我再次查看属性。
找到了用户对象
我在Spark 视图中 。它没有页面对象,但它确实有我需要的东西。 :)
Thanks for making me look at the properties again.
I found the user object in
within the Spark View. It doesn't have a page object, but it does have what I need. :)
您可以使用Page.User:
http://msdn.microsoft.com/en-us/library/system.web.ui.page.user%28v=VS.100%29.aspx
You can use Page.User:
http://msdn.microsoft.com/en-us/library/system.web.ui.page.user%28v=VS.100%29.aspx