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

I am writing a web service in vb.net/asp.net 2, that needs user’s name. It works fine when the url request is “www.mysite.com” but if any one has logged-in using “mysite.com” 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 mysite.com 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 www.mystite.com and mysite.com are set up seperately within IIS and mysite.com is set to allow anonymous access; meaning no authentication takes place when hitting this url.

Leave a Comment