Successfully got the url source and the images at least. But still i need to find the way to get the css,
js and swf. Obviousely css and
js script should be grabbed as text and swf as a binary stream or in the form which could be saved to disk. Still waiting from anybody to help or give any link which describes how to accomplish this. The source is as below;
public static string GetIEDocContents(string Url)
{
SHDocVw.ShellWindows objWins = new SHDocVw.ShellWindows();
mshtml.HTMLDocument objDoc;
string strContents="";
object refIndex = 1;
foreach(SHDocVw.InternetExplorer objIE in objWins)
{
if(objIE.LocationURL==Url)
{
objDoc = (mshtml.HTMLDocument) objIE.Document;
strContents= objDoc.body.parentElement.innerHTML;
if(strContents.IndexOf("<FRAME")>=0)
{
mshtml.FramesCollection objFrames = (mshtml.FramesCollection) objDoc.frames;
mshtml.IHTMLWindow2 objFrame = (mshtml.IHTMLWindow2)objFrames.item(ref refIndex);
strContents=objFrame.document.body.parentElement.i nnerHTML;
}
string strElName;
mshtml.IHTMLElement2 body2 = (mshtml.IHTMLElement2) objDoc.body;
mshtml.IHTMLControlRange controlRange = (mshtml.IHTMLControlRange) body2.createControlRange();
mshtml.IHTMLElementCollection objElCol;
objElCol = objDoc.getElementsByTagName("IMG");
foreach(mshtml.HTMLImg objImg in objElCol)
{
controlRange.add((mshtml.IHTMLControlElement)objIm g);
controlRange.execCommand("Copy", false, System.Reflection.Missing.Value);
controlRange.remove(0);
strElName = objImg.nameProp;
if (Clipboard.GetDataObject() != null)
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Bitmap))
{
Image image = (Image)data.GetData(DataFormats.Bitmap,true);
if(strElName.Substring(strElName.IndexOf(".")+1).T oLower()=="jpg")
image.Save(@"c:\images\"+strElName, System.Drawing.Imaging.ImageFormat.Jpeg);
else if(strElName.Substring(strElName.IndexOf(".")+1).T oLower()=="gif")
image.Save(@"c:\images\"+strElName, System.Drawing.Imaging.ImageFormat.Gif);
else
strElName = strElName; //to put a breakpoint and debug to see what's this.
}
else
strElName = strElName;
}
}
break;
}
}
return strContents;
}
BaburMan