Copy from other guys blog, please don't ask about how it works. post here just for a reference.
' Set the initial parameters Dim UserID AsString="myUsername"' Username Dim PWord AsString="myPassword"' Password Dim domain AsString="http://myDomain/secure" Dim encoding AsNew System.Text.ASCIIEncoding Dim CookieC AsNew Net.CookieContainer ' Use the appropriate HTML field names to stuff into the post header Dim PostData AsString= _ "txtUName="& UserID & _ "&txtPWord="& PWord ' Note: where txtUName & txtPWord are the field names Dim Data() AsByte= encoding.GetBytes(PostData) ' Initialise the request Dim LoginReq As Net.HttpWebRequest = Net.WebRequest.Create(domain &"default.asp") ' Login location taken from the form action With LoginReq .KeepAlive =False .Method ="POST" ' Note: if the page uses a redirect if will fail .AllowAutoRedirect =False .ContentType ="application/x-www-form-urlencoded" .ContentLength = Data.Length ' Set empty container .CookieContainer = CookieC EndWith ' Add the POST data Dim SendReq As IO.Stream = LoginReq.GetRequestStream SendReq.Write(Data, 0, Data.Length) SendReq.Close() ' Obtain the response Dim LoginRes As Net.HttpWebResponse = LoginReq.GetResponse() ' Retreive the headers from the request (e.g. the location header) Dim Redirect AsString= LoginRes.Headers("Location") ' Add any returned cookies to the cookie collection CookieC.Add(LoginRes.Cookies) ' Move to the redirected page as a GET request LoginReq = Net.WebRequest.Create(domain & Redirect) With LoginReq .KeepAlive =False .Method ="GET" .ContentType ="application/x-www-form-urlencoded" .AllowAutoRedirect =True .CookieContainer = CookieC EndWith ' Perform the navigate and output the HTML LoginRes = LoginReq.GetResponse() Dim sReader As IO.StreamReader =New IO.StreamReader(LoginRes.GetResponseStream) Dim HTML AsString= sReader.ReadToEnd Debug.Write(HTML)