if (!IsPostBack)
{
if (Session["UserName"] != null)
{
this.lblWelcomeMessage.Text = string.Format("Welcome {0}", Session["UserName"].ToString());
}
}
我想在longin之后添加用户名..我将如何显示用户名
答案 0 :(得分:2)
在验证用户登录凭据后,首先需要将用户名保存到会话
喜欢:Session["UserName"] = UserName;
然后在欢迎页面上, welcome.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
lb1.Text = "<b><font color=Brown>" + "WELCOME " +
"</font>" + "<b><font color=red>" +
Session["UserName"] + "</font>";
}
答案 1 :(得分:0)
工具箱 - &gt;访问 - &gt;登录名
将其放入asp页面,它会显示已登录用户的名称。