Here I will explain how to solve problem of HttpContext.Current.User.Identity.Name returns null or empty string value.
I have one requirement like getting system username based on that check the permissions of user if user has sufficient permission I need to allow that person to view the particular page otherwise I don’t want give chance to show the page for that I have written code to get username like this
string username = HttpContext.Current.User.Identity.Name.ToLower();
After that I run the application un expectdly I got username as null at that time again I checked my code to get username correctly at that time I found the mistake that is in web.config I write the authentication like this
Because of authentication mode="Forms" I got username is null that’s why I change th e authentication mode to Windows like this
Again I run the application and checked for username now I got the username successfully.