我做的网站采用三层架构 
数据层  逻辑层   表现层
我在逻辑层定义了一个类AboutCheck.cs
我写了如下判断代码  
public class AboutCheck
{
public AboutCheck(string SubjectA)
{
if (Session["admincheck"].ToString()!=Session.SessionID.ToString())
{
Response.Redirect("login.aspx");
}
} }
逻辑层添加system.web的引用 AboutCheck里面添加如下引用:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
编译该类提示说:
AboutCheck.cs(20): 名称“Session”在类或命名空间“WebClassOne.AboutCheck”中不存在
AboutCheck.cs(22): 找不到类型或命名空间名称“Response”(是否缺少 using 指令或程序集引用?)
应该不会出错阿 ,因为以前没有在逻辑层写过如上代码,请问我哪里做错了   
100分相送   问题解决立刻揭帖 在线等

解决方案 »

  1.   

    HttpContext.Current.Session
    HttpContext.Current.Response
      

  2.   

    HttpContext.Current.Session
    HttpContext.Current.Response
      

  3.   

    public class AboutCheck : Page
    或者
    HttpContext.Current.Session
      

  4.   

    System.Web.HttpContext.Current.Session["username"].ToString()
      

  5.   

    HttpContext.Current .Session["admincheck"]
      

  6.   

    it is really a bad design to access the data in the presentation layer this way and do redirection in business logic