title: How to get Web Session from cookie?
body: <p>I'm trying to do an scrape a web page but in order to Post the data I need a web session ID like</p>
  
  <blockquote>
    <p>web_session=HQJ3G1GPAAHRZGFR</p>
  </blockquote>
  
  <p>How can I get that ID?</p>
  
  <p>My code so far is:</p>
  
  <pre><code>Private Sub test()
  
      Dim postData As String = "web_session=HQJ3G1GPAAHRZGFR&amp;intext=O&amp;term_code=201210&amp;search_type=A&amp;keyword=&amp;kw_scope=all&amp;kw_opt=all&amp;subj_code=BIO&amp;crse_numb=205&amp;campus=*&amp;instructor=*&amp;instr_session=*&amp;attr_type=*&amp;mon=on&amp;tue=on&amp;wed=on&amp;thu=on&amp;fri=on&amp;sat=on&amp;sun=on&amp;avail_flag=on" '/BANPROD/pkgyc_yccsweb.P_Results 
      Dim tempCookie As New CookieContainer
      Dim encoding As New UTF8Encoding
      Dim byteData As Byte() = encoding.GetBytes(postData)
  
      System.Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Ssl3
      Try
  
          tempCookie.GetCookies(New Uri("https://taylor.yc.edu/BANPROD/pkgyc_yccsweb.P_Results"))
          'postData="web_session=" &amp; tempCookie.
  
          Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://taylor.yc.edu/BANPROD/pkgyc_yccsweb.P_Results"), HttpWebRequest)
          postReq.Method = "POST"
          postReq.KeepAlive = True
          postReq.CookieContainer = tempCookie
          postReq.ContentType = "application/x-www-form-urlencoded"
  
  
          postReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; Media Center PC 4.0; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
          postReq.ContentLength = byteData.Length
          Dim postreqstream As Stream = postReq.GetRequestStream
          postreqstream.Write(byteData, 0, byteData.Length)
          postreqstream.Close()
          Dim postresponse As HttpWebResponse
          postresponse = DirectCast(postReq.GetResponse, HttpWebResponse)
          tempCookie.Add(postresponse.Cookies)
  
          Dim postresreader As New StreamReader(postresponse.GetResponseStream)
          Dim thepage As String = postresreader.ReadToEnd
          MsgBox(thepage)
      Catch ex As WebException
          MsgBox(ex.Status.ToString &amp; vbNewLine &amp; ex.Message.ToString)
      End Try
  
  End Sub
  </code></pre>