我正在尝试捕获用户身份但无法捕获它。 我打开或关闭Windows功能并更新Windows身份验证, 但仍然无法捕获登录ID。 任何想法都将不胜感激。
c#code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string uid = "";
try { uid = Session["uid"].ToString(); }
catch { uid = ""; }
if (uid == "" || uid == null)
{
uid = Page.User.Identity.Name;
if (uid.Length > 0)
{
uid = uid.Substring(10);
}
}
}
}