I tried to add session and then i accessed on another page after redirect this always show null
Session.Add("pUser_Name", ds_1.Tables[0].Rows[0]["User_Name"].ToString());
HttpContext.Current.ApplicationInstance.CompleteRequest();
Response.Redirect("DashBoard.aspx", false);
here on another page i am accessing like this
protected void Page_Load(object sender, EventArgs e)
{
if (Session["pUser_Name"] == null) ////here is error NULL
{
Response.Redirect("Admin.aspx");
}
}
I tried
protected override void OnInit(EventArgs e)
{
if (Session["pUser_Name"] == null)
{
Response.Redirect("Admin.aspx");
}
base.OnInit(e);
}
and also
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DashBoard.aspx.cs" Inherits="SC.DashBoard" EnableTheming="true"
Theme="Theme1" EnableSessionState="True" %>
and Admin page where assigning value to session
<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="True" CodeBehind="Admin.aspx.cs" Inherits="SC.Admin" %>
and web.config file
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<sessionState timeout="12000"/>
</system.web>
but still facing same session is null