Cấp bậc tác giả:

DOTNET

Lỗi: Session state can only be used when enableSessionState is set to true either in a configuration

Được viết bởi webmaster ngày 30/05/2017 lúc 10:42 AM
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 \\ section in the application configuration.
  • 0
  • 5574

Lỗi: Session state can only be used when enableSessionState is set to true either in a configuration

Một lỗi về Session, lỗi này tương đối khó chịu đối với ai chưa thực sự triển khai trên server. Chi tiết lỗi như sau:

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.

Cách để fix lỗi này:

Vào web.config, chỉnh như sau:
<system.webServer>
       <modules runAllManagedModulesForAllRequests="true">
        <remove name="Session" />
        <add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
</system.webServer>

Nguồn bài viết: DOTNET.VN

BÌNH LUẬN BÀI VIẾT

Bài viết mới nhất

LIKE BOX

Bài viết được xem nhiều nhất

HỌC HTML