winforms - is the c# webbrowser reliable? -
i try attaching custom document events fire sometime; don't.
worse, here scenario can test. not sure if os problem. win7 machine, , has ie 11 installed.
i start localhost python web server , serve static web page:
c:\code\forex> python -m simplehttpserver 4542
and try load above web page in webbrowser control. form's code follows:
using system; using system.diagnostics; using system.windows.forms; namespace winformwebbrowser { public partial class form1 : form { public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { webbrowser1.documentcompleted += webbrowser1_documentcompleted; webbrowser1.navigate("http://localhost:4542"); } void webbrowser1_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { if (webbrowser1.readystate == webbrowserreadystate.complete) { debug.print("ready"); } } } }
i ready message. once close form, local web server broken result.
ps c:\code\forex> python -m simplehttpserver 4542 serving http on 0.0.0.0 port 4542 ... 127.0.0.1 - - [10/jun/2015 19:06:42] "get / http/1.1" 200 - 127.0.0.1 - - [10/jun/2015 19:12:01] "get / http/1.1" 200 - ---------------------------------------- exception happened during processing of request ('127.0.0.1', 29758) traceback (most recent call last): file "c:\python27\lib\socketserver.py", line 295, in _handle_request_noblock self.process_request(request, client_address) file "c:\python27\lib\socketserver.py", line 321, in process_request self.finish_request(request, client_address) file "c:\python27\lib\socketserver.py", line 334, in finish_request self.requesthandlerclass(request, client_address, self) file "c:\python27\lib\socketserver.py", line 655, in __init__ self.handle() file "c:\python27\lib\basehttpserver.py", line 340, in handle self.handle_one_request() file "c:\python27\lib\basehttpserver.py", line 310, in handle_one_request self.raw_requestline = self.rfile.readline(65537) file "c:\python27\lib\socket.py", line 476, in readline data = self._sock.recv(self._rbufsize) error: [errno 10054] existing connection forcibly closed remote ho st ----------------------------------------
so question webbrowser control work properly?
Comments
Post a Comment