异常详细信息: System.Web.HttpException: 请求在此上下文中不可用源错误: 
行 37:  string UserID;
行 39:  ComputerIP = Request.ServerVariables["REMOTE_ADDR"];
行 40:  UserID = Session["LoginID"].ToString();
行 41:

解决方案 »

  1.   

    where is this code? in a class library? when is it called?
    ComputerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
    UserID = System.Web.HttpContext.Current.Session["LoginID"].ToString();
      

  2.   

    我试到可以了,但session值我没有用System.Web.HttpContext.Current.也可以接收到,为什么Request.ServerVariables["REMOTE_ADDR"]不可以直接取到的?为什么不可以引用名字空间,这样就不用写这么长了?
      

  3.   

    where is your code? what superclass is your class derived from?