Start New Discussion within our Web Development Community

Good Afternoon,

Im trying to get the value, of the standar headlogin name from the asp, username, nut getting all null exeptions, the code that i used was:

        //var Login1 = ((Login)HeadLoginView.FindControl("HeadLoginName"));

        //var Login1 = ((LoginName)HeadLoginView.FindControl("HeadLoginName"));

        //LoginName Login1 = ((LoginName)HeadLoginView.FindControl("HeadLoginName"));
        //string userName = Login1.UniqueID.ToString();

        //string Username = User.Identity.Name;
        //Label1.Text = Username;

        //LoginName Login1 = ((LoginName)HeadLoginView.FindControl("HeadLoginName"));
        //string userName = Convert.ToString(Login1);

        //Login Login1 = ((Login)HeadLoginView.FindControl("HeadLoginName"));
        //string userName = Login1.UserName.ToString();

        //var userName = ((Login)HeadLoginView.FindControl("HeadLoginName"));
        //Label1.Text = Convert.ToString(userName);

        //LoginName loginName = (LoginName)HeadLoginView.FindControl("HeadLoginName");
        //Label1.Text = Convert.ToString(loginName);

        //string merda = (HttpContext.Current.User.Identity.Name);

        //LoginName loginName = HeadLoginView.FindControl("HeadLoginName") as LoginName;
        //Label1.Text = (loginName.ToString());  `

i receive null exception basically, can anybody help with this.

Best Regards

This article has been dead for over six months. Start a new discussion instead.