error:
Only in a configuration file or in the Page directive enableSessionState set to true, you can use the session state. Also make sure <configuration> In the application configuration \ <system.web> \ <httpModules> section comprises System.Web.SessionStateMod or custom session state module.
Solution:
<
pages
enableSessionState
="true"
></
pages
>
Reproduced in: https: //www.cnblogs.com/TSPWater/archive/2012/03/16/2399981.html