HttpContext.Current.User.Identity.Name with and without www

I am writing a web service in vb.net/asp.net 2 that requires a username. It works great when requesting the URL ā€œwww.mysite.comā€, but if someone logged in using ā€œmysite.comā€ without ā€œwwwā€ and goes to the page that calls my web service, HttpContext.Current . User.Identity.Name gives a null value.

How can I solve this problem?

Many thanks,

+3
source share
2 answers

If you use forms authentication, try setting the domain to in mysite.comin the element <forms>.

+3
source

How is this configured in IIS (if you are using IIS)?

, , , , www.mystite.com mysite.com IIS, mysite.com ; , URL- .

0

Source: https://habr.com/ru/post/1770479/


All Articles