Hi all,
I have to get a HTML content of a given URL, to inspect links and images and
to change something in there, and to save the result. I have done it already
with:
System.Net.WebC lient source = new System.Net.WebC lient();
StreamReader mr = null;
try
{
mr = new StreamReader(so urce.OpenRead(s Url));
sWebPage = mr.ReadToEnd();
}
catch
{
oParent.PagesDo ne++;
return;
}
finally
{
if (mr != null)
mr.Close();
}
After that I make a lot of IndexOfs' and Replaces to change the things I
want, and as it is sooooo ugly :( and slow.
So I decided to see if I can use MSHTML's IHTMLDocument2 interface, and just
to find and change values I need, but ... so far I couldn't imagine how to
place the string in the IHTMLDocument2 object and how to retrieve it from
there after that in order to save it.
Any clues will be highly appreciated.
Thanks
Sunny
I have to get a HTML content of a given URL, to inspect links and images and
to change something in there, and to save the result. I have done it already
with:
System.Net.WebC lient source = new System.Net.WebC lient();
StreamReader mr = null;
try
{
mr = new StreamReader(so urce.OpenRead(s Url));
sWebPage = mr.ReadToEnd();
}
catch
{
oParent.PagesDo ne++;
return;
}
finally
{
if (mr != null)
mr.Close();
}
After that I make a lot of IndexOfs' and Replaces to change the things I
want, and as it is sooooo ugly :( and slow.
So I decided to see if I can use MSHTML's IHTMLDocument2 interface, and just
to find and change values I need, but ... so far I couldn't imagine how to
place the string in the IHTMLDocument2 object and how to retrieve it from
there after that in order to save it.
Any clues will be highly appreciated.
Thanks
Sunny
Comment