Satya
Satya

Reputation: 8346

How to call any url from aspx page?

I have one .aspx page and inside that page I want to call third party url and I should include the content from that url. I can achive this by using iframe but i am restricted to not to use iframe.

Ex:

    <body>
         my content ......
         ..................
         <Video><url="www.yamaha.com\learnPiano">  Thirdparty video get played here      </url>           </Video>
         .................
          ..................... my content .... 
    </body>

Upvotes: 0

Views: 935

Answers (2)

Doozer Blake
Doozer Blake

Reputation: 7797

Look into WebRequest and WebResponse.

Upvotes: 1

Ken Pespisa
Ken Pespisa

Reputation: 22266

You can do this on the server side. Add an ASP:Literal control to your page and name it "OtherContent" for example.

var webRequest = WebRequest.Create("http://www.google.com");
var webResponse = webRequest.GetResponse();
if (webResponse != null)
{
  var responseStream = webResponse.GetResponseStream();
  if (responseStream != null)
  {
    var streamReader = new StreamReader(responseStream);
    var pageSource = streamReader.ReadToEnd();
    OtherContent.Text = pageSource;
  }
}

Upvotes: 0

Related Questions