Thursday, March 14, 2013

Simple way to display information from another Website

Simple way to display information from another Website
Here i would like to share a simple trick to display information from another website using Web response.By using this trick we can display information from others website using the website URL either statically or dynamically. Already i have shared some
articles "How to get Images from others wesbite using url" and "How to get title and meta tags from others website using URL". So lets start how to implement this trick First, Select one New website Next, Add one Label in design page Code :

Next, Add the following namespaces in code behind
using System;
using System.Net;
using System.IO;

Next, Write the following code in Page load
WebRequest wReq = WebRequest.Create("");
            WebResponse mRes = wReq.GetResponse();
            StreamReader sr = new StreamReader(mRes.GetResponseStream());
            string sHTML = sr.ReadToEnd();

            if (sHTML != string.Empty && sHTML != null)
                lblDisplay.Text = sHTML;

That's it.Happy coding

Labels: , , , ,