Basically I am trying to check the Session
value from the .html page
. SO what far I done that is
In ASPX
I am storing the value in session
and redirect into an html
page.
Session["user_id_no"] = "1234";
Response.Redirect(url);
From HTML I am calling an REST GET
method.
var check= $.ajax({
url: "/loginCheck",
type: 'GET',
success: function (result) {
return result;
},
async:false
});
REST API and Method implementation
[HttpGet]
[Route("loginCheck")]
public bool checkLoginStatus()
{
SessionClass sc = new SessionClass();
bool user_id_check = sc.check("user_id_no");
return user_id_check;
}
Session Class is implemented as
public class SessionClass : System.Web.UI.Page
{
public bool check(string sessionName)
{
if (Session[sessionName] == null)
return false;
return true;
}
}
But I am getting exception.
HResult=-2147467259 Message=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.
But in my web.config
<sessionState mode="InProc" timeout="30" />
I have also went through some question