how to login to youtube and save cookies? vb.net - vb.net

I have this code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim logincookie As New CookieContainer
Dim postData As String = "continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dheader%26nomobiletemp%3D1%26hl%3Den_US%26next%3D%252F&service=youtube&uilel=3&dsh=-5804339713411277263&ltmpl=sso&hl=en_US&GALX=kpcgpuXEK94&pstMsg=1&dnConn=&checkConnection=youtube%3A4148%3A1&checkedDomains=youtube&timeStmp=&secTok=&Email=" & user_fb.Text & "&Passwd=" & pass_fb.Text & "&signIn=Sign+in&PersistentCookie=yes&rmShown=1"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://accounts.google.com/ServiceLoginAuth"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "https://accounts.google.com/ServiceLoginAuth"
postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko)"
postReq.ContentLength = byteData.Length
Dim postreqstream As Stream = postReq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
logincookie = tempCookies
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
WebBrowser1.DocumentText = thepage
End Sub
trying to make a tool for youtube upload video but it seems to have a cookies problem when I try to sign in !
it says that cookies must be allowed to run this action !
how can I enable cookies ?

Define one more Cookie container in the beginning:
Dim oRequestCookie As New CookieContainer
Try to add
CType(postReq, HttpWebRequest).CookieContainer = oRequestCookie
When you are defining the HttpWebRequest parameters.
And then at the end you can extract the login cookie as you already did.
Cheers.

The Problem is that your refer page should put some cookies in user machine
https://accounts.google.com/ServiceLoginAuth
then when your try to login google check for these cookies before you could login and as now google will find to cookies. The Solution is to access your refer page first and make sure to use CookieContainer in that page then call your code and it will work 100%.
Try to solve the problem logically then move to think about errors in your code.

...
Dim galx As New Cookie
galx.Name = "GALX"
galx.Value = "something"
galx.Domain = ".google.com"
Dim postData As String = "GALX=something&continue=http%3A%2F......
...
tempCookies.Add(galx)
I was searching exactly this "youtube login" thing. I got same message on webbrowser1 with "grudolf"s code. Then i looked firefox's "tools/developer console" while log in to youtube. There was a cookie collection with members "ACCOUNT_CHOOSER", "GALX", "GAPS" etc... When i add a cookie named "GALX" with any vale and add same into post data, result was OK. I just added code. I hope it will help...

Related

Post Data for a site in httpwebrequest

so i am trying to login to a website using httpwebrequest. the post data i got from a http debugger is
code i am trying is:
Dim postData As String = "securitycheck=85b39cc89f04bc1612ce9d0c384b39ca&do_action=log_into_system&jump_to=https%3A%2F%2Fwww.dreamstime.com%2F&uname=jawademail&pass=jawadpass"
Dim tempCookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://www.dreamstime.com/securelogin.php"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = tempCookies
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "https://www.dreamstime.com/login.php"
postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.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)
tempCookies.Add(postresponse.Cookies)
logincookie = tempCookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
RichTextBox1.Text = thepage
thsi code does not seem to post data in website i get referer page code in richtextbox after running the code.
First GET the page, find the "securitycheck" in its source and extract it.
Combine it with the rest of your data then send it with POST.
Ok so I felt like trying:
Dim LoginData As String
Dim LoginCookies As New CookieContainer() 'Move this outside of sub/function so you can use it later
Dim LoginRequest As HttpWebRequest = WebRequest.Create("https://www.dreamstime.com/login.php")
LoginRequest.CookieContainer = LoginCookies
LoginRequest.KeepAlive = True
LoginRequest.AllowAutoRedirect = True
LoginRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0"
Dim LoginResponse As HttpWebResponse = LoginRequest.GetResponse()
Dim LoginResponseRead As StreamReader = New StreamReader(LoginResponse.GetResponseStream())
Using LoginResponseRead
Do
Dim line As String = LoginResponseRead.ReadLine
If line.Contains("var securitycheck=") Then
LoginData = "securitycheck=" & line.Substring(line.IndexOf("=") + 2, line.LastIndexOf("'") - line.IndexOf("=") - 2)
Exit Do
End If
Loop
End Using
Dim byteData As Byte() = Encoding.UTF8.GetBytes(LoginData)
LoginRequest = WebRequest.Create("https://www.dreamstime.com/securelogin.php")
LoginRequest.CookieContainer = LoginCookies
LoginRequest.Method = "POST"
LoginRequest.KeepAlive = True
LoginRequest.ContentType = "application/x-www-form-urlencoded"
LoginRequest.Referer = "https://www.dreamstime.com/login.php"
LoginRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
LoginRequest.ContentLength = byteData.Length
Dim postreqstream As Stream = LoginRequest.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
LoginResponse = LoginRequest.GetResponse()
LoginResponseRead = New StreamReader(LoginResponse.GetResponseStream())
Dim thepage As String = LoginResponseRead.ReadToEnd
'Now with GET request grab whatever you want, DON'T forget to use cookie.
Result
>>>securitycheck=183d5abdb01f288aacbe5b2893555ec5
Dim email As String = "something"
Dim password As String = "somethingelse"
LoginData &= "&do_action=log_into_system&jump_to=https%3A%2F%2Fwww.dreamstime.com%2F&uname=" & email & "&pass=" & password
>>>securitycheck=183d5abdb01f288aacbe5b2893555ec5&do_action=log_into_system&jump_to=https%3A%2F%2Fwww.dreamstime.com%2F&uname=something&pass=somethingelse
There, practically done.
I took a look at this myself and it appears that with every login request a token is sent that identifies your "session", specifically:
securitycheck=85b39cc89f04bc1612ce9d0c384b39ca
This token changes every time you login, and if it isn't valid the site redirects you back to the login page, asking you to login again.
Sites usually do this to prevent Cross-Site Request Forgery (CSRF). This means that you will most likely not be able to login to this site without using an actual web browser.
Here's the code that was tested and it works. It uses System.Net.Http.HttpClient rather WebClient (since it supports concurrent requests). This code is just a model since its main goal is to show the idea how to work with this site. There are additional explanations in comments. You also need to import System.Web dll.
Imports System.Net.Http
Imports System.Web
Imports System.Text.RegularExpressions
Public Class TestForm
Private Const URL_MAIN$ = "https://www.dreamstime.com"
Private Const URL_LOGIN$ = "https://www.dreamstime.com/securelogin.php"
Private Const URL_LOGOUT$ = "https://www.dreamstime.com/logout.php "
Private Const USER_AGENT$ = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
"AppleWebKit/537.36 (KHTML, Like Gecko) " +
"Chrome/68.0.3440.15 Safari/537.36 OPR/55.0.2991.0 " +
"(Edition developer)"
Private Const LOGIN$ = "<USER_NAME>"
Private Const PASS$ = "<USER_PASSWORD>"
Private token$
Private Async Sub OnGo() Handles btnGo.Click
Dim html$
Using client = New HttpClient()
client.DefaultRequestHeaders.Add("User-Agent", USER_AGENT)
Using req = New HttpRequestMessage(HttpMethod.Get, URL_MAIN)
Using resp = Await client.SendAsync(req)
html = Await resp.Content.ReadAsStringAsync()
End Using
End Using
'// Search for security token
Dim m = Regex.Match(
html,
"<input type=""hidden"" name=""securitycheck"" value=""(?'token'\w+)"">")
If Not m.Success Then
MessageBox.Show("Could not find security token.")
Return
End If
'// Get security token
token = m.Groups("token").Value
'// Try to login.
'// For logging to work, we need to use FormUrlEncodedContent class.
'// Also we need to use it every time we do POST requests.
'// No need for it for GET requests (as long as the HttpClient is the same).
Using req = New HttpRequestMessage(HttpMethod.Post, URL_LOGIN) With
{
.Content = GetFormData()
}
Using resp = Await client.SendAsync(req)
html = Await resp.Content.ReadAsStringAsync()
End Using
End Using
'// Go to main page to check we're logged in.
'// "html" variable now MUST contain user's account name.
Using req = New HttpRequestMessage(HttpMethod.Get, URL_MAIN$)
Using resp = Await client.SendAsync(req)
html = Await resp.Content.ReadAsStringAsync()
End Using
End Using
'// Logout.
'// "html" variable now MUST NOT contain user's account name.
Using req = New HttpRequestMessage(HttpMethod.Get, URL_LOGOUT)
Using resp = Await client.SendAsync(req)
html = Await resp.Content.ReadAsStringAsync()
End Using
End Using
End Using
End Sub
Function GetFormData() As FormUrlEncodedContent
Return New FormUrlEncodedContent(New Dictionary(Of String, String) From
{
{"securitycheck", token},
{"do_action", "log_into_system"},
{"jump_to", ""},
{"uname", HttpUtility.HtmlEncode(LOGIN)},
{"pass", HttpUtility.HtmlEncode(PASS)}
})
End Function
End Class

VB.net - HttpWebRequest POST (login to Instagram.com)

I would like to know how will see log into sites like instagram.com, as I have the same question for twitter, my doubt comes when trying to log in by code without the webbrowser using method post in vb.net, trying to use this code returns me on instagram Error 404:
Dim postData As String = "csrfmiddlewaretoken=" & TextBox1.Text & "&username=xxxxx&password=xxxxx"
Dim tempCookies As New CookieContainer
Dim encoding As New ASCIIEncoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://instagram.com/accounts/login/"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = cokkie
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "https://instagram.com/accounts/login/"
postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0"
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)
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
RichTextBox1.Text = thepage
I get the csrfmiddlewaretoken the instagram page by method get, really do not understand, but I think I read that I must first get a cookie before log in, but really do not know, if anyone can help me I would greatly appreciate
Are you looking for
http://instagram.com/developer/authentication/
trying to simulate a user logging into the normal web sight seems like hard work, Instagram supports OAuth 2.0 and if you search Nuget for OAuth you will find a whole load of packages to to the work for you.
for reference you can find twitter info at https://dev.twitter.com/docs
Tim
I figured it out, we actually need to send cookies to be able to logging, the code here for those people who have the same question:
Public cokkie As CookieContainer
Public Sub cookie()
'Dim webClient As New System.Net.WebClient
'Dim result As String = webClient.DownloadString("https://instagram.com/accounts/login")
Dim postData As String = ""
Dim tempCookies As New CookieContainer
Dim encoding As New ASCIIEncoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://instagram.com/accounts/login"), HttpWebRequest)
postReq.CookieContainer = tempCookies
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
tempCookies.Add(postresponse.Cookies)
cokkie = tempCookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
RichTextBox1.Text = thepage
TextBox1.Text = cokkie.ToString
Dim regx As New Regex("name=""csrfmiddlewaretoken"" value=""(.*?)""/>", RegexOptions.IgnoreCase)
Dim mactches As MatchCollection = regx.Matches(thepage)
For Each match As Match In mactches
TextBox1.Text = match.Value
TextBox1.Text = TextBox1.Text.Replace("name=""csrfmiddlewaretoken"" value=""", "")
TextBox1.Text = TextBox1.Text.Replace("""/>", "")
Next
End Sub
Public Sub log()
Dim postData As String = "csrfmiddlewaretoken=" & TextBox1.Text & "&username=xxxx&password=xxxx"
Dim tempCookies As New CookieContainer
Dim encoding As New ASCIIEncoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://instagram.com/accounts/login/"), HttpWebRequest)
postReq.Method = "POST"
postReq.KeepAlive = True
postReq.CookieContainer = cokkie
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.Referer = "https://instagram.com/accounts/login/"
postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0"
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)
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
RichTextBox1.Text = thepage
End Sub

Enable cookies in WinForms webbrowser

i was trying to make a bot for a facebook game .. the problem is that the user need to login to facebook . i tried to make this with httpwebrequest . everything went fine but i got an error saying my web browser doesn't support cookies
here is the code i used for the httpwebrequest
Dim postData As String = "lsd=AVrFBNXT&display=&enable_profile_selector=&legacy_return=1&next=&profile_selector_ids=&trynum=1&timezone=-120&lgnrnd=163248_FehM&lgnjs=1372203160&email=" & (TextBox1.Text) & "&pass=" & (TextBox2.Text) & "f&default_persistent=1"
Dim tempcookies As New CookieContainer
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postreq As HttpWebRequest = DirectCast(HttpWebRequest.Create("https://www.facebook.com/login.php"), HttpWebRequest)
postreq.Method = "POST"
postreq.KeepAlive = True
postreq.CookieContainer = tempcookies
postreq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729"
postreq.ContentType = "application/x-www-form-urlencoded"
postreq.Referer = "https://www.facebook.com/login.php"
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)
tempcookies.Add(postresponse.Cookies)
logincookie = tempcookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
WebBrowser1.DocumentText = thepage
Webbrowser control is essentially an embedded Internet Explorer and thus shares Internet Explorer's settings.
If your IE has cookies enabled then your WebBrowser control has them enabled too and your problem could be elsewhere.
To check your IE settings follow these steps:
Choose "Internet Options" under the "Tools" menu on the IE;
Select the "Privacy" tab.
Click the "Advanced..." button in the "Settings" groupbox.
Check the "Override automatic cookie handling" option.
Check both "Accept" options.
Click "OK"

Trouble Authenticating with WP remote login request

Okay so I was going to post this on the last 3 errors I got, but I fixed those all(thankfully). I no longer get any kind of cookie blocked message, however now I get a Error logging in whether I'm putting in the correct password or an invalid one. I think its either
A. a cookie storage error.
B. or a problem with redirection.
Imports System.Text
Imports System.Net
Imports System.IO
Public Class Form1
Dim logincookie As CookieContainer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim postData As String = "log=" & TextBox1.Text & "&pwd=" & TextBox2.Text & "wp- submit=Log+In&redirect_to=""http://csvlife.com/wp-admin/" & "&wordpress_test_cookie=1"
Dim tempcookies As New CookieContainer()
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postreq As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://csvlife.com/wp-login.php"), HttpWebRequest)
postreq.Method = "POST"
postreq.KeepAlive = True
postreq.AllowAutoRedirect = True
postreq.CookieContainer = tempcookies
postreq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6pre) Gecko/20100903 Firefox/4.0b6pre"
postreq.ContentType = "application/x-www-form-urlencoded"
postreq.Referer = "http://csvlife.com/wp-login.php"
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)
tempcookies.Add(postresponse.Cookies)
logincookie = tempcookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
If thepage.Contains("ERROR") Then
MsgBox("Error logging in!")
Else
MsgBox("Lets Start Blogging!")
End If
End Sub
End Class
I have my fiddler open and I've logged into the page and noticed that when I login regularly from by regular browser
fiddler will show this:
then the results come in and it looks like this:
Clarification: The pictures above is what the web traffic info looks like when I login from any basic browser on my computer
Here is what it looks like what I login from the program:
Always an error.
And the request number is just 200 no 302 before or after.
However when I try through my program the req number always remains 200 which is post. Its like it never gets to redirect and I don't know why. Notes: This is my website and this not for any kind of malware or whatever. Its just for blog automation. If there was anything else I could find on this matter I would. At this point I have no other option. Thank you kindly for your help and consideration.
In line 9:
Dim postData As String = "log=" & TextBox1.Text & "&pwd=" & TextBox2.Text & "wp- submit=Log+In&redirect_to=""http://csvlife.com/wp-admin/" & "&wordpress_test_cookie=1"
The parameters to be sent with the post need to be separated with an ampersand, as written the password parameter has "wp- submit=Log+In&redirect_to=http://csvlife.com/wp-admin/" appended to it.
Assuming wp is a parameter:
Dim postData As String = "log=" & TextBox1.Text & "&pwd=" & TextBox2.Text & "&wp- submit=Log+In&redirect_to=""http://csvlife.com/wp-admin/" & "&wordpress_test_cookie=1"

HTTPWebRequest Login POST is not Redirecting

I need to use HTTPWebRequest to login to an external website and redirect me to the default page. My code below is behind a button - when clicked it currently tries to do some processing but stays on the same page. I need it to redirect me to the default page of the external website without seeing the login page. Any help on what I'm doing wrong?
Dim loginURL As String = "https://www.example.com/login.aspx"
Dim cookies As CookieContainer = New CookieContainer
Dim myRequest As HttpWebRequest = CType(WebRequest.Create(loginURL), HttpWebRequest)
myRequest.CookieContainer = cookies
myRequest.AllowAutoRedirect = True
myRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1"
Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(), HttpWebResponse)
Dim responseReader As StreamReader
responseReader = New StreamReader(myResponse.GetResponseStream())
Dim responseData As String = responseReader.ReadToEnd()
responseReader.Close()
'call a function to extract the viewstate needed to login
Dim ViewState As String = ExtractViewState(responseData)
Dim postData As String = String.Format("__VIEWSTATE={0}&txtUsername={1}&txtPassword={2}&btnLogin.x=27&btnLogin.y=9", ViewState, "username", "password")
Dim encoding As UTF8Encoding = New UTF8Encoding()
Dim data As Byte() = encoding.GetBytes(postData)
'POST to login page
Dim postRequest As HttpWebRequest = CType(WebRequest.Create(loginURL), HttpWebRequest)
postRequest.Method = "POST"
postRequest.AllowAutoRedirect = True
postRequest.ContentLength = data.Length
postRequest.CookieContainer = cookies
postRequest.ContentType = "application/x-www-form-urlencoded"
postRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1"
Dim newStream = postRequest.GetRequestStream()
newStream.Write(data, 0, data.Length)
newStream.Close()
Dim postResponse As HttpWebResponse = CType(postRequest.GetResponse(), HttpWebResponse)
'using GET request on default page
Dim getRequest As HttpWebRequest = CType(WebRequest.Create("https://www.example.com/default.aspx"), HttpWebRequest)
getRequest.CookieContainer = cookies
getRequest.AllowAutoRedirect = True
Dim getResponse As HttpWebResponse = CType(getRequest.GetResponse(), HttpWebResponse)
'returns statuscode = 200
FYI - when i add in this code at the end, i get the HTML of the default page I'm trying to redirect to
Dim responseReader1 As StreamReader
responseReader1 = New StreamReader(getRequest.GetResponse().GetResponseStream())
responseData = responseReader1.ReadToEnd()
responseReader1.Close()
Response.Write(responseData)
Any help on whats missing to get the redirect working?
Cheers
The HttpWebRequest only automatically redirects you if the server sends an HTTP 3xx redirection status with a Location field in the response. Otherwise you are supposed to manually navigate to the page by using Response.Redirect, for example. Also keep in mind that the automatic redirection IGNORES ANY COOKIES sent by the server. That may be the problem in your case if the server is actually sending a redirection status.