I have a web application in VB.NET. Recently I have upgraded its .net framework to 4.6.1.
In one of the pages, Session values are being read in an InitializeCulture method. Note that those values are set in other pages from where redirection has happened to this page.
It works fine when I run the application from Visual Studio 2017, however when deployed to IIS with app pool of 4.0 classic , the session values are always considered as Nothing and control goes inside If block.
I also tried the solution given in Can't use Session in InitializeCulture but it is not working.
What may be the issue?
Protected Overrides Sub InitializeCulture()
'Below condition is always true
If (Session("Country") Is Nothing) Or (Session("ID") Is Nothing) Then
Response.Redirect("OtherPage.aspx")
End If
End Sub