Page.User.Identity.Name , a bit different in when there are caps?
Posted
Wednesday, June 28, 2006 3:59 PM
by
Shunjie
I am using DataList for my website to display a set of users and for each item, it will have a set of links which the audience can click on. However, if the audience had signed in and is viewing his own profile, I must hide away the set of links (for example, it make no sense for a user to send a PM to himself)
Therefore I used Page.User.Identity.Name to check. For the ItemTemplate, its simply:
Visible=<%# Eval("name").ToString().Equals(Page.User.Identity.Name) %>
This works well for IE and Firefox, but 1-2 users are telling me that they actually see the command!
A quick trial-and-error solve the problem. Changed code to:
Visible=<%# Eval("name").ToString().Equals(Page.User.Identity.Name, StringComparison.CurrentCultureIgnoreCase) %>
Thus, for developers using User.Identity.Name, this maybe something to consider for.