Display username in all pages after logging in
-
I want to display the username once the user logs in successfully. iam using loginview control in the master page but how to insert the username in the logged in template of the loginview control.. everytime by default it displays the value in the logged in template instead of anonymous template.. plzz suggest some solution
-
I want to display the username once the user logs in successfully. iam using loginview control in the master page but how to insert the username in the logged in template of the loginview control.. everytime by default it displays the value in the logged in template instead of anonymous template.. plzz suggest some solution
Hi, In loggin page u can do below code to assign the user name in either way: Use label in master page: 1. Session["UserName"]="Anil"; //Set string str =Session["UserName"].ToString(); /Get Or 2. Context.User.Identity.Name ="Anil" // Set string str=Context.User.Identity.Name ;//Get
Regards Anil Pal
-
Hi, In loggin page u can do below code to assign the user name in either way: Use label in master page: 1. Session["UserName"]="Anil"; //Set string str =Session["UserName"].ToString(); /Get Or 2. Context.User.Identity.Name ="Anil" // Set string str=Context.User.Identity.Name ;//Get
Regards Anil Pal
with the following code iam tryin to access label control of the master page and modify it: 1. Dim mplabel As New Label 2. mplabel = CType(PreviousPage.Master.FindControl("Label1"), _ Label) 3. If Not mplabel Is Nothing Then 4. mplabel.Text = "welcome" 5. End If but still iam gettin an nullreference exception in line 2:object reference not set to an instance of an object.
modified on Friday, April 3, 2009 4:21 PM
-
with the following code iam tryin to access label control of the master page and modify it: 1. Dim mplabel As New Label 2. mplabel = CType(PreviousPage.Master.FindControl("Label1"), _ Label) 3. If Not mplabel Is Nothing Then 4. mplabel.Text = "welcome" 5. End If but still iam gettin an nullreference exception in line 2:object reference not set to an instance of an object.
modified on Friday, April 3, 2009 4:21 PM