Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));创建上面代码时需创建RESPONSE对象
System.Web.HttpResponse Response = new HttpResponse(tw);
这时又要创建System.IO.TextWrite 对象
System.IO.TextWrite tw=new ??????
可是都没有NEW方法?请问大侠们怎么解决?

解决方案 »

  1.   

     HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create(url); 
      

  2.   

    HttpWebResponse response = (HttpWebResponse)request1.GetResponse();
      

  3.   

            HttpCookie ck = new HttpCookie("");
            HttpResponse hr = HttpContext.Current.Response;
            hr.Cookies.Add(ck);
      

  4.   

    内置的Response也就是Page.Response 本来就是HttpResponse的一个实例, 他的类型就是HttpResponse 不知道你还要创建一个干嘛 ,不明白。。 
      

  5.   

    我要在C#中进行登录ASP。NET应用程序的工作:
     FormsAuthentication.SetAuthCookie("炼化公司管理员", false);
                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                    1,
                    "炼化公司管理员",
                    System.DateTime.Now,
                    System.DateTime.Now.AddMinutes(240),
                    false,
                    "rjb" + "|" + "炼化公司管理员" + "|" + "WebEMS" + "|" + "10000" + "|" + " 炼化公司管理员" + "|" + "0" + "|" + "aasdasd" + "|" + "asasdas");
                string encTicket = FormsAuthentication.Encrypt(ticket);            System.IO.TextWriter tw;
                System.Web.HttpResponse Response = new HttpResponse(tw); ;

                
                Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
                //Response.Redirect("Index.aspx");
                System.Diagnostics.Process.Start("http://10.114.110.50/index.aspx");