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

Member Avatar for LastMitch

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

Read this ( it has a code snippet and solution to the issue you are having ):

http://forums.asp.net/t/1835799.aspx/1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.