By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,533 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,533 IT Pros & Developers. It's quick & easy.

login in to Orkut

P: 1
Hi all,

I a beginner in to asp.net and learning to use httpwebrequest. I am trying to login to orkut.com using the following code.... but unfortunatly i am unable to login to it

Can some one please help me by correcting the code....

Thanks in advance...
Expand|Select|Wrap|Line Numbers
  1. Dim cookieJar As CookieContainer = New CookieContainer
  2.         Dim webReq As HttpWebRequest
  3.         Dim webResp As HttpWebResponse
  4.         Dim sr As StreamReader
  5.         Dim sw As StreamWriter
  6.         Dim payLoad As String
  7.         Dim txt As String
  8.         Dim urlstring As String = "http://www.orkut.com"
  9.         Dim uristring As String = ""
  10.  
  11.         webReq = CType(WebRequest.Create(New Uri(urlString)), HttpWebRequest)
  12.         webReq.CookieContainer = cookieJar
  13.         webReq.Credentials = CredentialCache.DefaultCredentials
  14.         webReq.UserAgent = "BGClient"
  15.         webReq.KeepAlive = True
  16.         webReq.Headers.Set("Pragma", "no-cache")
  17.         webReq.Timeout = 5000
  18.         webReq.Method = "GET"
  19.  
  20.         ' get login page
  21.         webResp = webReq.GetResponse
  22.  
  23.         sr = New StreamReader(webResp.GetResponseStream)
  24.         txt = sr.ReadToEnd.Trim
  25.         sr.Close()
  26.         webResp.Close()
  27.  
  28.         webReq = CType(WebRequest.Create(New Uri(urlString & uriString)), HttpWebRequest)
  29.         webReq.CookieContainer = cookieJar
  30.         webReq.Credentials = CredentialCache.DefaultCredentials
  31.         webReq.UserAgent = "BGClient"
  32.         webReq.KeepAlive = True
  33.         webReq.Headers.Set("Pragma", "no-cache")
  34.         webReq.Timeout = 5000
  35.         webReq.Method = "POST"
  36.         webReq.ContentType = "application/x-www-form-urlencoded"
  37.  
  38.         payLoad = "Login=admin&Password=fuck&submit=Login&Validation Req=1&WhichBrowser=Microsoft+Internet+Explorer&pgB rowserVersion=4.0+(compatible;+MSIE+6.0;+Windows+N T+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+1.0.3705)"
  39.  
  40.         webReq.ContentLength = payLoad.Length
  41.         sw = New StreamWriter(webReq.GetRequestStream)
  42.         sw.Write(payLoad)
  43.         sw.Close()
  44.  
  45.         ' post login parms
  46.         webResp = webReq.GetResponse
  47.  
  48.         sr = New StreamReader(webResp.GetResponseStream)
  49.         txt = sr.ReadToEnd.Trim
  50.         MsgBox(txt)
  51.         sr.Close()
  52.         webResp.Close()
Oct 15 '09 #1
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
You aren't using ASP.NET.
It looks like you're developing a windows desktop application......
Oct 16 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.