• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

338
Views
Session variables getting lost when navigating to a different controller (& AJAX requests), however session vars set during Session_Start is intact

This question is about an issue we are facing with a .net framework based MVC app that uses windows authentication. The variables set during Session_Start seems to be just fine and available throughout, but any session variable set after the fact seems to be lost. In the output below, first line is where we set a session variable. The exception is when I am trying to access it in a different page. However if you notice other session variables set during Session_Start are still available. This is issue 1.

Current session value (home): zero
---
(different page)
System.NullReferenceException: Object reference not set to an instance of an object.
   at ---removed---
   at ---removed---
Id (from session): 0
Name (from session): Admin
Email (from session): admin@admin.com

We explored further and it also seems like AJAX requests are creating a whole new session. This is issue 2. We have tried a number of things - update the $.ajax call to xhrfields/withCrdentials, tried setting an AutoRedirectMode using the FriendlyUrls package, tried ignoring a few routes suggested, etc. But nothing helps. So any pointers regarding this would be appreciated.

Thanks!

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

We found the issue. Looks like some process (most likely the anti-virus) is messing with the bin directory causing the application to be restarted again and again. So we added the fcnMode attribute to the httpRuntime element and set it to Disabled so as to disable the behavior for now.

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error