C#与服务器建立会话,获取SessionId(临时cookie值)

    public static string GetSessionId(string URL)
        {
            WebRequest wrt;
            wrt = WebRequest.Create(URL);
            WebResponse wrp;

            wrp = wrt.GetResponse();

            string html = new StreamReader(wrp.GetResponseStream(), Encoding.UTF8).ReadToEnd();
            return   wrp.Headers.Get("Set-Cookie");
            
        }

posted @ 2010-03-30 16:01  A light heart lives long  阅读(1798)  评论(0编辑  收藏  举报