display user name
-
HI, Help me for a very simple thing.. I want to display the name of the windows loggin user on the right top of my web page...that means when ever the user run my application his/her name should be displayed on that page....like "welcome abc" Please help me... Thanks
-
HI, Help me for a very simple thing.. I want to display the name of the windows loggin user on the right top of my web page...that means when ever the user run my application his/her name should be displayed on that page....like "welcome abc" Please help me... Thanks
Hi, You can use "this.User.Identity.Name" to get the name of the Windows User making the request for the page. This will return the username as [Domain or Machine name]\UserName If you now want to remove the domain or machine name then you need to do some string manipulation. Note : This property won't work when you are running the site with authentication mode as anonymous. regards, Aryadip. Cheers !! and have a Funky day !!
-
Hi, You can use "this.User.Identity.Name" to get the name of the Windows User making the request for the page. This will return the username as [Domain or Machine name]\UserName If you now want to remove the domain or machine name then you need to do some string manipulation. Note : This property won't work when you are running the site with authentication mode as anonymous. regards, Aryadip. Cheers !! and have a Funky day !!
-
Hi Aryadip, I tryed to use your code in the following way but its giving me the blank output...why?...why not the windows user name.. lblUserName.Text=this.User.Identity.Name.ToString(); reply me thanks.
hi, As I have told you earlier, the code won't work if you have given your site anonymous access. Your site needs authentication mode as "Windows Authentication". To Enable it... Open IIS console... Navigate to the Virtual folder of your application. Right click on the virtual folder and select "properties" Go to "Directory Security" Tab Click on "Edit" of "anonymous asccess and authentication control" section. You will get "Authentication Methods" window. The top most authentication method is " Anonymous" and the buttom most is "Windows Authentication". All you need to do is UNCHECK anonymous and CHECK "Windows Authentication" and restart your application.. I mean make a fresh request from a new instance of browser... I guess this time you will get it right... regards, Aryadip. Cheers !! and have a Funky day !!
-
HI, Help me for a very simple thing.. I want to display the name of the windows loggin user on the right top of my web page...that means when ever the user run my application his/her name should be displayed on that page....like "welcome abc" Please help me... Thanks