IE10 and Windows 8 and ASP.NET MVC (IIS 7)

I have a very interesting but unpleasant problem. I have an MVC 4 site working with standard ASP.NET authentication.

In and only in IE 10 combination in Windows 8, when I cross my site and go to the http url with https-url (both on the same site), it generates another asp.net_sessionid value. In every other browser / OS browser I tried, this does not seem to be a problem.

I searched high and low, and although I certainly found that people experience various authentication problems (usually with respect to IIS7, which does not recognize IE10 as a browser), I did not find anyone who claims to experience this exact a problem. Moreover, I published the draft MVC template out of the box and has the same problem. I cannot be the only one that has encountered this problem (I hope, I hope).

Anyone else come across this? Or maybe there are some suggestions?

thanks

UPDATE

Good, so there is another important aspect. I run this in a load balanced environment. If I push applications to a single server and test, I have no problem.

+6
source share
1 answer

You mentioned that you had this problem in a load balanced environment, right? I assume that you are using the default "In Proc" method to store session data. If so, then I think I know what might happen. (for the sake of argument, I will take 2 servers, but it really doesn't matter if you have more)

You go to ServerA and a session is created. Because it is In Process ServerB has no idea about it. In the end (and how this happens, it's a question of how your balancer is configured. Sticky session? Cookies? Round robin?), You will be sent to ServerB. Since this server did not know that you already have a session; a new one is created and you are assigned a new session identifier.

So why does this happen under your play points? Well, I suspect that given enough time and load, you will see that it just moves from / page 1 to / page2. Again - it depends on how your load balancer is configured, but it may be because you are changing the protocol that starts something, and you are sent to another server in the pool.

How can you fix this?
To get started, make sure you have the same machine key in the machine.config file. If you do not have access to this, I think it will work in web.config, but I have not tried it.

Now configure a different way to store session state. Perhaps on a Sql or MySql or Postgres server, or anywhere. If you have SQL Server, which will be the easiest since it was created, but if you have another data warehouse, you will need to either build or find a library that will do this. I was working on a project in which we used Postgres to store session state.

We used npgsql as a driver to connect to the server and created our own PgsqlSessionProvider:SessionStateStoreProviderBase , and its connection is really easy

 <sessionState mode="Custom" customProvider="PgsqlSessionProvider"> <providers> <add name="PgsqlSessionProvider" type="My.namespace.PgsqlSessionStateStore" connectionStringName="connectionStringName" writeExceptionsToEventLog="true" /> </providers> </sessionState> 
+1
source

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


All Articles