– HttpContext.Current.User.Identity.Name with and without www – Education Career Blog

I am writing a web service in 2, that needs user’s name. It works fine when the url request is “” but if any one has logged-in using “” without a “www” and goes to the page that calls my web service, The HttpContext.Current.User.Identity.Name gives null.

How can I resolve this problem?

Many thanks,


If you are using forms authentication try setting the domain to in the <forms> element.


How is this set up in IIS (assuming you are using IIS)?

One thing that would explain what you see would be that and are set up seperately within IIS and is set to allow anonymous access; meaning no authentication takes place when hitting this url.

Leave a Comment