locked
Session variables null in new app subdirectory RRS feed

  • Question

  • User1117542579 posted

    As the subject line eludes to, I added a new directory to my asp.net application (Windows Server 2012). When I access .aspx files in the new directory, all the session variables are null. I can immediately navigate to another directory, and session variables work as expected. What would cause session variables to be null in a newly added directory? 

    Wednesday, July 25, 2018 3:16 PM

Answers

  • User475983607 posted

    What would cause session variables to be null in a newly added directory? 

    I assume the subject is IIS.  The steps to reproduce the behavior is creating a new application within an existing application.  Isolation between application is the expected behavior.

    Make sure the new app is running under the same application pool as the parent app. 

    Other than that you'll need to explain exactly what you are doing and the steps to reproduce as I'm guessing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 25, 2018 4:06 PM

All replies

  • User475983607 posted

    What would cause session variables to be null in a newly added directory? 

    I assume the subject is IIS.  The steps to reproduce the behavior is creating a new application within an existing application.  Isolation between application is the expected behavior.

    Make sure the new app is running under the same application pool as the parent app. 

    Other than that you'll need to explain exactly what you are doing and the steps to reproduce as I'm guessing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 25, 2018 4:06 PM
  • User753101303 posted

    Hi,

    Or it seems you added a new directory with new aspx files which triggers an application restart. See https://blogs.msdn.microsoft.com/johan/2007/05/16/common-reasons-why-your-application-pool-may-unexpectedly-recycle/

    Wednesday, July 25, 2018 4:18 PM
  • User1117542579 posted

    Thanks for your comment. In this case, there were two factors that prohibited access to the session variables, one of which was the application pool being different from the parent application's app pool. The second was that I failed to include a couple of files that are specific to the system. Those files contain code that iterates through a form collection and creates session variables based on related names and values. The session variables didn't exist due to the missing files, and they were not accessible due to the difference in application pools. 

    Wednesday, July 25, 2018 8:20 PM