Rupesh
Rupesh

Reputation: 7906

WPF : Invalid URI: The format of the URI could not be determined

i want to get the you tube video info. So I prepared the url and call it as following

String YouTubeVideoInfo = "www.youtube.com/get_video_info?video_id=" + FinalVideoId;

                **WebRequest HttpWReq = (WebRequest)WebRequest.Create(YouTubeVideoInfo);**
                WebResponse HttpWResp = (WebResponse)HttpWReq.GetResponse();
                Stream stream = HttpWResp.GetResponseStream();
                StreamReader reader = new StreamReader(stream);
                string contents = reader.ReadToEnd();

but above code give the error. So i just want to know whether there are any way to call this url without adding protocol (http, https)

Upvotes: 0

Views: 1109

Answers (1)

Joey
Joey

Reputation: 354406

No, you cannot. How would WebRequest know about the protocol if you don't give it a URI? As it stands it's definitely missing the protocol part and as such you cannot pass it as URI to anything that expects one.

Upvotes: 3

Related Questions