从 ajax 调用中,在后面的代码中设置会话值会给出错误消息
From ajax call, setting session value in code behind gives error message
在后台代码加载页面时,会话值的设置工作正常。 但是从 ajax 调用 中,它给出 错误消息 作为 Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
会话数据是 Public Property SessionData(sessionVariableName As String) As String
代码隐藏:
SessionData("UserRole") = "Supervisor"
我通过在webmethod
中添加EnableSession:=True
来实现
在后台代码加载页面时,会话值的设置工作正常。 但是从 ajax 调用 中,它给出 错误消息 作为 Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
会话数据是 Public Property SessionData(sessionVariableName As String) As String
代码隐藏:
SessionData("UserRole") = "Supervisor"
我通过在webmethod
EnableSession:=True
来实现