更新时间:2023-10-12 19:13:52
也许你必须检查,如果用户进行身份验证或没有,因为文本框里面的AnonymousTemplate或者它是一个命名空间的问题( WebControls.Login
)
Maybe you must check if the user is authenticated or not, because the TextBox is inside the AnonymousTemplate or it's a Namespace issue(WebControls.Login
):
if (!HttpContext.Current.User.Identity.IsAuthenticated) {
Login lg = (WebControls.Login)LoginView1.FindControl("Login1");
TextBox tb = (TextBox)lg.FindControl("UserName");
Label2.Text = tb.Text;
}
但通常你会得到通过适当的属性,用户名/密码UserName/Password的登录
。
修改:您的额外的截图是非常小的,但我看到你得到一个InvalidCastException,所以我对空间问题asumption是正确的。
Edit: Your added screenshot is very small but i see that you are getting an InvalidCastException, so my asumption on the namespace issue was correct.