Thursday, February 5, 2009

User.Identity.Name returns Empty String

@ times, in a web page if we try to access User.Identity.Name an empty string is returned...

Wondering the cause for it??

Check your Web.config.
This problem occurs because the authentication-related variables in the ServerVariables collection are not populated if you use Anonymous Access security to access the .aspx page. This problem can also occur if you give the Anonymous user access in the section of the Web.config file. To avoid it, proceed with the following two steps.
1. Change the authentication type to anything other than None.
2.This is the important step, deny the access for anonymous user




No comments:

Post a Comment