试试将你的类mycookie象webform一样继承Page类看看,应该能实现的

解决方案 »

  1.   

    cookieUsername = HttpContext.Current.Request.Cookies("myCookie").Value)
      

  2.   

    如果我要判断是否这个myCookie的值为空的话,应该怎么写呢?
      

  3.   

    Object.Equals(HttpContext.Current.Request.Cookies("myCookie"),null)
      

  4.   

    我将HttpContext.Current.Request.Cookies("cookieUsername").Value赋值给String 和Object都报错:Object reference not set to an instance of an object. 我应该怎么办呢?