首页 > 解决方案 > Asp.net - 如何为每个用户创建一个页面

问题描述

基本上我想要一个可以看到用户详细信息的页面。喜欢 twitter 或 facebook 个人资料页面。

标签: asp.netasp.net-mvcasp.net-core

解决方案


设计一个html页面。例如,Profile.cshtml 文件。发送登录到此页面的用户信息,并将此数据写入您要设置的位置。

 public ActionResult Profile()
 {
      ViewBag.User = User;
      return View();
 }

html之间以这种方式实现

<div>@ViewBag.User.Name</div>

推荐阅读