HttpWebRequest Form Authentication Not Getting Past Login Page


I am trying to use the POST method with a HttpWebRequest object while passing in real login credentials and am failing to get past the login page. (The credentials down there are real, but not mine personally =D)

I got the same code to work for but cannot get it to work for

Any help in getting past the login page so I can retrieve the after login page would be much appreciated.

Dim strUrl As String = ""

ServicePointManager.Expect100Continue = False
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3

Dim webRequest As HttpWebRequest
Dim responseReader As StreamReader
Dim responseData As String
Dim postData As String = ""
Dim cookies As CookieContainer = New CookieContainer()
Dim requestWriter As StreamWriter

'post form data to page
webRequest = HttpWebRequest.Create(strUrl)
webRequest.Method = WebRequestMethods.Http.Post
webRequest.ContentType = "application/x-www-form-urlencoded"
webRequest.CookieContainer = cookies
webRequest.ContentLength = postData.Length

requestWriter = New StreamWriter(webRequest.GetRequestStream)

'recieve cookie

'now we send the cookie
webRequest = HttpWebRequest.Create("")
webRequest.CookieContainer = cookies
responseReader = New StreamReader(webRequest.GetResponse.GetResponseStream())
responseData = responseReader.ReadToEnd()

SpillLabel.Text = Server.HtmlEncode(responseData)

Open in new window

Who is Participating?
mohali786Author Commented:
500 points for you man! How did I mis that? Thanks Sybe! =D
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.