Click here to Skip to main content
16,006,442 members
Home / Discussions / C#
   

C#

 
AnswerRe: view state Pin
Christian Graus14-Sep-06 19:19
protectorChristian Graus14-Sep-06 19:19 
QuestionDll Import Problem in loading two c++ assemblies with same name Pin
He is Cool14-Sep-06 18:50
He is Cool14-Sep-06 18:50 
GeneralRe: Dll Import Problem in loading two c++ assemblies with same name Pin
Guffa14-Sep-06 19:15
Guffa14-Sep-06 19:15 
GeneralRe: Dll Import Problem in loading two c++ assemblies with same name Pin
He is Cool14-Sep-06 19:50
He is Cool14-Sep-06 19:50 
QuestionWin32 Functions InteropServices problems Pin
erikkl200014-Sep-06 17:28
erikkl200014-Sep-06 17:28 
Questionlooking for tab control like office 2003 shared workspace's style? Pin
jacktom14-Sep-06 17:09
jacktom14-Sep-06 17:09 
QuestionHow to develop an ie extension similar as google notebook? Pin
rryyjw14-Sep-06 16:09
rryyjw14-Sep-06 16:09 
QuestionHow to grab a web page using .Net 2.0 WebBrowser Control Pin
rryyjw14-Sep-06 16:06
rryyjw14-Sep-06 16:06 
Hi All,

I want to grab a page using WebBrowser Control (see code below). I try to get the page content through DocumentText property in "DocumentCompleted" event handler, but it seems that the event won't be triggered. The "Navigated" event won't be triggered either. However, the "Navigating" event does.
I used to use HttpWebRequest/HttpWebResponse to grab webpage content, however, the drawback is that I can't get the full loaded page through it. What I mean by this is that maybe some javascript will execute to modify elements on the page after it's loaded, I call this page as full loaded page. I think using WebBrowser Control can overcome this drawback. It's just like a browser, and it'll execute those javascript after loading the page. But I can't make this control work correctly. Could anyone help me? I'm very appreciate.

Thanks
Jie

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ConsoleApplication1
{
class Program
{
static WebBrowser wb;

[STAThread]
static void Main(string[] args)
{
Go();
}

private static void Go()
{
wb = new WebBrowser();
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
wb.Navigating +=new WebBrowserNavigatingEventHandler(wb_Navigating);
wb.Navigated += new WebBrowserNavigatedEventHandler(wb_Navigated);
wb.Navigate("http://www.google.com");
Console.ReadLine();
}

static void wb_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
Console.WriteLine("Navigating");
}

static void wb_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
Console.WriteLine("Navigated");
}

static void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
Console.WriteLine("DocumentCompleted");
Console.WriteLine(wb.DocumentText);
}
}
}

AnswerRe: How to grab a web page using .Net 2.0 WebBrowser Control Pin
Nader Elshehabi14-Sep-06 16:32
Nader Elshehabi14-Sep-06 16:32 
AnswerRe: How to grab a web page using .Net 2.0 WebBrowser Control Pin
scott_hackett18-Sep-06 20:47
scott_hackett18-Sep-06 20:47 
QuestionAnother managed/unmanaged problem Pin
Kasic Slobodan14-Sep-06 15:32
Kasic Slobodan14-Sep-06 15:32 
AnswerRe: Another managed/unmanaged problem Pin
Nader Elshehabi14-Sep-06 15:58
Nader Elshehabi14-Sep-06 15:58 
GeneralRe: Another managed/unmanaged problem Pin
Kasic Slobodan15-Sep-06 1:59
Kasic Slobodan15-Sep-06 1:59 
QuestionRe: Another managed/unmanaged problem Pin
Kasic Slobodan15-Sep-06 7:53
Kasic Slobodan15-Sep-06 7:53 
AnswerRe: Another managed/unmanaged problem Pin
Nader Elshehabi15-Sep-06 12:38
Nader Elshehabi15-Sep-06 12:38 
GeneralRe: Another managed/unmanaged problem Pin
Kasic Slobodan16-Sep-06 1:29
Kasic Slobodan16-Sep-06 1:29 
GeneralRe: Another managed/unmanaged problem Pin
Nader Elshehabi16-Sep-06 1:44
Nader Elshehabi16-Sep-06 1:44 
GeneralRe: Another managed/unmanaged problem [modified] Pin
Kasic Slobodan17-Sep-06 1:12
Kasic Slobodan17-Sep-06 1:12 
QuestionHow can I download video files programmatically in C# [modified] Pin
desamsetty14-Sep-06 13:18
desamsetty14-Sep-06 13:18 
AnswerRe: How can I download video files programmatically in C# Pin
Dominic Pettifer14-Sep-06 13:35
Dominic Pettifer14-Sep-06 13:35 
AnswerRe: How can I download video files programmatically in C# Pin
scott_hackett18-Sep-06 21:22
scott_hackett18-Sep-06 21:22 
QuestionMemory Leak in C#.NET 2005 Pin
clint198214-Sep-06 10:31
clint198214-Sep-06 10:31 
AnswerRe: Memory Leak in C#.NET 2005 Pin
Christian Graus14-Sep-06 13:49
protectorChristian Graus14-Sep-06 13:49 
GeneralRe: Memory Leak in C#.NET 2005 Pin
clint198215-Sep-06 22:19
clint198215-Sep-06 22:19 
AnswerRe: Memory Leak in C#.NET 2005 Pin
Hamid_RT15-Sep-06 6:41
Hamid_RT15-Sep-06 6:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.