Session lost using hostname instead of IP address (IE)

I am learning asp.net mvc 2, it is very excting with me.

I created a small MVC2 application, it works fine in the ASP.net Development Server that built it. However, when deploying to IIS 7.5, Window Server 2008 R2 Enterprise, there is something wrong. The awlays session is null when I access the application through IE and use the hostname to specify the URL.

Using IE (IE 7 or IE8) to access my application with the link http: // localhost / or ipaddress => every working tone

But when I use IE (IE 7 or IE8) to access my application with the link http: / hostname / => session always null

I am surprised while FireFox works fine in all cases, both from the built-in ASP.net Development Server, and for the IIS server, both with host names, and with ip and localhost.

I really appreciate your advice!

thank

+2
source share
4 answers

I found out the problem caused by the hostname of the web server, which has an underscore. Thanks to everyone.

+4
source

@khoailang

I had the same problem, and it turned out that a problem with IE occurs when you use a machine name with an underscore in your name.

eg. machine_01 / app / Default.aspx => Session lost!

while 10.100.0.1/app.Default.aspx works where 10.100.0.1 is the IP for machine_01.

Any idea why this is happening?

+1
source

cookie, , cookie IE.

, cookie , .

cookieless-, URL- , , -. , mvc.

0

http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names:

Internet Standards (Request Comments) for protocol credentials these component host name labels can only contain ASCII letters 'a' through "z" (case insensitive) digits "0" through '9' and a hyphen ('-'). No other characters, punctuation, or spaces are missing. allowed.

Underscoring host names causes a number of strange, inconsistent issues, including problems with sending mail, SQL replication that doesn't work in an unexpected way, and most RDP connections fail.

0
source

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


All Articles