C # to establish a session with the server, get SessionId (temporary cookie value)

    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");
            
        }

Reproduced in: https: //www.cnblogs.com/daretodream/archive/2010/03/30/1700708.html

Guess you like

Origin blog.csdn.net/weixin_34392843/article/details/93324172