简体   繁体   中英

Opening a Internet Explorer browser window to a specific URL in C#

I need to do program in c# which opens an internet page and after the page finish to load ("done") , I need to take a timestamp to see how much time it took.
How can I do this?

You need something like this:

        WebRequest myWebRequest = WebRequest.Create(strURL);  
        WebResponse myWebResponse = myWebRequest.GetResponse();  
        Stream ReceiveStream = myWebResponse.GetResponseStream(); 
        Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); 
        StreamReader readStream = new StreamReader( ReceiveStream, encode ); 
        string strResponse=readStream.ReadToEnd(); 
        StreamWriter oSw=new StreamWriter(strFilePath); 
        oSw.WriteLine(strResponse); 
        oSw.Close(); 
        readStream.Close(); 
        myWebResponse.Close(); 

Measure the time before and after the code above to see how much it took.

Thanks, Flores

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM