C# – How to detect if page load in newly-started browser process fails


I use Process.Start("firefox.exe", "http://localhost/page.aspx");
And how i can know page fails or no?
How to know via HttpWebRequest, HttpWebResponse page fails or not?

When i use

HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("somepage.aspx");
HttpWebResponse loWebResponse = (HttpWebResponse)myReq.GetResponse();
Console.Write("{0},{1}",loWebResponse.StatusCode, loWebResponse.StatusDescription);

how can I return error details?

Not need additional plugins and frameworks. I want to choose this problem only by .net

Any Idea please

Best Solution

Use Watin to automate firefox instead of Process.Start. Its a browser automation framework that will let you monitor what is happening properly.


edit: see also Google Webdriver http://google-opensource.blogspot.com/2009/05/introducing-webdriver.html