session访问

   ResinSession so=(ResinSession)Session["obj"];
    if ( so != null)
   {
    proxyid= so.proxyid;
   }
   else
   {
    Response.Redirect(Application["appPath"] + "logout.aspx");
   }

=====
   Session["_masterYear"]=DropDownList1.SelectedItem.Value;
   Session["_masterMonth"]=DropDownList2.SelectedItem.Value;
取得
   if(Session["_masterYear"]!=null)
   {
    string year=Session["_masterYear"].ToString();
    string month=Session["_masterMonth"].ToString();
    //Label3.Text=Session["_masterYear"].ToString()+Session["_masterMonth"].ToString();
    DataGrid1.DataSource =ProxyQuerySalesRPT.GetSalesDetails(nbbm,year,month,proxy);
    DataGrid1.DataBind();
   }
   else
   {
    Response.Write("<SCRIPT LANGUAGE=javascript> alert(\"当前页面的父面页已过期,请关闭当前窗口,并刷新父页面!\");</SCRIPT>");
 
   }

原文地址:https://www.cnblogs.com/hhq80/p/656722.html