HttpWebRequest Form Authentication Not Getting Past Login Page

Posted on 2010-08-19
Last Modified: 2012-05-10

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

Question by:mohali786
LVL 28

Accepted Solution

sybe earned 500 total points
ID: 33475685

Author Comment

ID: 33480473
500 points for you man! How did I mis that? Thanks Sybe! =D

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now