Get url returned from request redirect

  • Thread starter Thread starter Smokey Grindel
  • Start date Start date
S

Smokey Grindel

Right now I am posting data to a webpage by doing the following

webRequest =
CType(System.Net.WebRequest.Create("http://www.domain.com/login.asp"),
Net.HttpWebRequest)

webRequest.Method = "POST"

webRequest.CookieContainer = Cookies

postData = "Submit=Go&id=asdDSDFsdf&pid=34g4"

data = System.Text.Encoding.UTF8.GetBytes(postData)

webRequest.ContentType = "application/x-www-form-urlencoded"

webRequest.ContentLength = data.Length

Dim RequestStream As IO.Stream = webRequest.GetRequestStream

RequestStream.Write(data, 0, data.Length)

RequestStream.Close()

webResponse = CType(webRequest.GetResponse(), Net.HttpWebResponse)



Now when I send that, the response is a new webpage (it redirected to it
after it authenticated my login account) I dont want to get the entire page
retured, I just want the URL that the new page is on, is there any way to do
this with out downloading the entire response (its large and a waste of
bandwidth since all I need is just the URL)... the URL is in the format of
http://www.domain.com/nextpage.asp?GUID=45T45G45G45G45G45WGREGDG

Any help would be nice, thanks!
 
Right now I am posting data to a webpage by doing the following

webRequest =
CType(System.Net.WebRequest.Create("http://www.domain.com/login.asp"),
Net.HttpWebRequest)

webRequest.Method = "POST"

webRequest.CookieContainer = Cookies

postData = "Submit=Go&id=asdDSDFsdf&pid=34g4"

data = System.Text.Encoding.UTF8.GetBytes(postData)

webRequest.ContentType = "application/x-www-form-urlencoded"

webRequest.ContentLength = data.Length

Dim RequestStream As IO.Stream = webRequest.GetRequestStream

RequestStream.Write(data, 0, data.Length)

RequestStream.Close()

webResponse = CType(webRequest.GetResponse(), Net.HttpWebResponse)

Now when I send that, the response is a new webpage (it redirected to it
after it authenticated my login account) I dont want to get the entire page
retured, I just want the URL that the new page is on, is there any way to do
this with out downloading the entire response (its large and a waste of
bandwidth since all I need is just the URL)... the URL is in the format ofhttp://www.domain.com/nextpage.asp?GUID=45T45G45G45G45G45WGREGDG

Any help would be nice, thanks!

You have to get the entire response to find the url, I think. Or you
have to know your GUID
 
Back
Top