views:

33

answers:

1

I'm thinking of a way of creating a local backup for the pages I will be linking to from my site. This would be text-only, similar to Google's 'Copy' feature on the search pages. The idea is to be sure that the pages I would reference to, or cite from, do not dissapear from the Web in the near future. I know I could just keep local copies, but I will have A LOT of citations.

What would be the best way of achieving this in ASP.NET? Some custom caching in database?

A: 

Use this function to get page content and You can save it in your database. your table must contain 2 columns: 1-url 2-pagecontent

static string GetHtmlPage(string PageURL)
{

  String r;
  WebResponse wres;
  WebRequest wreq= HttpWebRequest.Create(PageURL);
  wres= wreq.GetResponse();
  using (StreamReader sr = new StreamReader(wres.GetResponseStream()))
  {
    r= sr.ReadToEnd();
    sr.Close();
  }
  return r;
}
desmati