需要显示存储在 AspNetUser 表中的某些值



我正在使用下面的代码来查看是否可以显示存储在AspNetUser表中的描述,数量,价格和值的值。我在第二个"IF"中的第一次尝试没有产生除了用户 ID。我继续添加最后三行,但最后一行中的"字符串"未被接受。

有人请插个主意!!

 public partial class Account : System.Web.UI.Page
{
    public string Description { get; internal set; }
    public string Quantity { get; internal set; }
    public string Price { get; internal set; }
    public string Value { get; internal set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (User.Identity.IsAuthenticated)
            {
                StatusText.Text = string.Format("Hello {0}!! ", User.Identity.GetUserName(), Description, Quantity, Price, Value);
                LoginStatus.Visible = true;
                LogoutButton.Visible = true;
            }
            else
            {
                LoginForm.Visible = true;
            }
        }
        var userStore = new UserStore<IdentityUser>();
        var userManager = new UserManager<IdentityUser>(userStore);
        var user = userManager.string(Description, Quantity, Price, Value);
    }
}
I removed the last three statements above and added two other lines in their place so i now have below:
public partial class Account : System.Web.UI.Page
{
public string Description { get; internal set; }
public string Quantity { get; internal set; }
public string Price { get; internal set; }
public string Value { get; internal set; }
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        if (User.Identity.IsAuthenticated)
    {
     StatusText.Text = string.Format("Hello {0}!! ", User.Identity.GetUserName(), Description, Quantity, Price, Value);                                         
     LoginStatus.Visible = true;
     LogoutButton.Visible = true;
        }
        else
        {
            LoginForm.Visible = true;
        }
    }
    var user = HttpContext.Current.GetOwinContext().Get<ApplicationUserManager>  ().FindById(User.Identity.GetUserId());
    Response.Write(user.Description + "" + user.Quantity + "" + user.Price + "" + user.Value);
}

}

I have not run it yet but all the parameters were accepted in development.

相关内容

  • 没有找到相关文章

最新更新