首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

小弟我在CS文件中编译为何说没有System.Web.HttpContext.Current.Session?(ASP.NET1.1)

2011-12-13 
我在CS文件中编译为何说没有System.Web.HttpContext.Current.Session?(ASP.NET1.1)usingSystemusingSyste

我在CS文件中编译为何说没有System.Web.HttpContext.Current.Session?(ASP.NET1.1)
using   System;
using   System.Collections;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Web;
using   System.Web.SessionState;
using   System.Web.HttpContext.Current.Session;


namespace   WebMonitor.Util
{
///   <summary>
///   SessionUtil   的摘要说明。
///   </summary>
public   class   SessionUtil
{
public   static   String   GetSession(String   sessionName)
{
return   Session[sessionName].ToString();
}

public   static     String   SetSession(String   sessionName,String   sessionValue)
{
Session[sessionName]   =   sessionValue;
}

public   static     bool   IsSessionSet(String   sessionName)
{
return   Session[sessionName]==null?false:true;
}

}
}


[解决办法]
去掉using System.Web.HttpContext.Current.Session;
写成
System.Web.HttpContext.Current.Session[sessionName] = sessionValue;
[解决办法]
public static String GetSession(String sessionName)
{
return Session[sessionName].ToString(); // 假如 Session[sessionName] == null ,调用此方法就翘鞭子了 ...
}

热点排行