I have simple webapp , which need to get the current logged on user name of the system.
I tried with :
Label1.Text = HttpContext.Current.User.Identity.Name.ToString();
But this was blank as Anonymous User access was checked. When I unchecked Anonymous user Access then I am unable to browse the web site with error
You are not authorized to view this page
I am using windows authentication in web.config
<authentication mode="Windows"/>