GEt The Response URl

  • Thread starter Thread starter Rajkiran R.B.
  • Start date Start date
Rajkiran R.B. said:
Whenever I type some url like

http://youtube.com/watch/v/54GRe3ox_xI

in firefox browser when the address is immediately redirected to

http://youtube.com/swf/l.swf?video_id=54GRe3ox_xI&rel=1&eurl=&iurl=
http%3A//i.ytimg.com/vi/54GRe3ox_xI/default.jpg&t=OEgsToPDskJ98NGh0lWiWIogmOD9369L

Is there a way in C# to get the above url

I tried implementing Using The HttpWebRequest And HttpWebResponse Class but
no use

It should be fine with HttpWebRequest. You should get a 302 back.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Rajkiran,

You have to set the AllowAutoRedirect property on the HttpWebRequest
instance to false (the default is true). When this property is true, it
will automatically redirect the request on a 302 response to the URL
indicated in the 302 response. This will prevent that from happening and
return the 302 response to you, along with the redirect information.
 
Back
Top