To describe the app, it has an default page where it will be checking user role from request header then assign the user id into session and redirect to corresponding pages. In every other pages, it will check whether the session has value or not, if no then will redirect the default page.
This has been tested in my dev environment and its working without any issue. However, when I hosted it in IIS (AWS EC2 environment). It started behaving very weird. If the application's bindings is stick to default. I can browse it in the server using http://localhost:26943/ with no issue.
However, when i change the bindings to hostname and browse using http://testing.com/, I found that the session containing user ID is empty.
I have tried several methods including :
- Add Session["init"] = 0 in Global.asax
- Change cookieless=true in web.config
- Change sessionState's mode to "StateServer"
- Redirect to "~/page.aspx" instead of "page.aspx"
Only change cookieless method worked for me but it will show session ID in the URL which I doubt is the correct method.
Details of app:
- .NetFramework 4.8
- Uses WCF service
- Current session state info is sessionState mode="InProc" cookieless="false" timeout="60"
- Configured c:\Windows\System32\Drivers\etc\hosts to add 127.0.0.1 testing.com
- Tested using IE 11