2012-03-22 9 views

答えて

0

いいえ、それはありません。私は、次の試してみました:

DocumentText:

File.WriteAllText(@"C:\doc.txt", webBrowser1.DocumentText, Encoding.UTF8); 

getElementsByTagNameの( "HTML")

HtmlElement elem; 
if (webBrowser1.Document != null) 
{ 
    HtmlElementCollection elems = webBrowser1.Document.GetElementsByTagName("HTML"); 
    if (elems.Count == 1) 
    { 
     elem = elems[0]; 
     string pageSource = elem.OuterHtml; 
     File.WriteAllText(@"C:\doc.txt", pageSource, Encoding.UTF8); 
    } 
} 

のIOleCommandTarget

public void ShowSource() 
{ 
    IOleCommandTarget cmdt = null; 
    object o = null; 
    object oIE = null; 
    try { 
      cmdt = (IOleCommandTarget)this.Document.DomDocument; 
      cmdt.Exec(cmdGUID, oCommands.ViewSource, 1, o, o); 
    } catch (Exception ex) { 
      throw new Exception(ex.Message.ToString(), ex.InnerException); 
    } finally { 
      cmdt = null; 
    } 
} 

唯一の方法は、すべてのフレームのドキュメントを通過することですが。

更新のiframeは別のURLを持っている場合は、when trying to retrieve iframe document

UnauthorizedAccessExceptionを取得します
関連する問題