问题描述
我有一个本地的登录网页,想实现的功能是在winform上点一个button,IE打开这个本地网页,然后自动登录,用户名密码最好是程序传进去这个该怎么办到?试过用webbrowser,但是后续的网页上点了一个按钮后会跳到IE上打开新网页,然后session和cookie不能传递过去,导致要重新输用户名和密码登录,看了网上的教程,想做到强制在同一个webbrowser打开,但没有实现。所以现在希望能直接在用IE打开,然后自动登录。谢谢!
解决方案
解决方案二:
参考:http://www.google.com.hk/#hl=zh-CN&newwindow=1&safe=strict&q=+site:topic.csdn.net+webbrowser+ie+%E5%85%B1%E4%BA%AB+cookie&sa=X&ei=QxbqTvrQKabcmAW-5t2gCg&ved=0CDAQrQIwAA&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=bc5fd6da1ee87cbb&biw=1280&bih=929
解决方案三:
找的我眼睛都花了,呵呵其实我想要的很简单,也有可能是我想的简单了,我的登录页面是这样的<html><body><formaction="https://ti-pass.ext.ti.com/cgi-bin/login/login.pl"method="post"name="userid_form"enctype="application/x-www-form-urlencoded"><inputtype="text"name="fld2"id="fld2"/><br/><inputtype="text"name="fld5"id="fld5"autocomplete="off"/><br/><inputtype="image"tabindex="103"src="./myti_gl_submit.gif"alt="Submit"name="Submit"/><inputtype="hidden"name="fld1"value="a8f4565d0a1295e506191718d2d3f65d"/><inputtype="hidden"name="portal"value="1"/><inputtype="hidden"name="OKPage"value="http://ftds.ext.ti.com/WLTV/AppServlet?action=CheckPermissionServ&forward=jsp/MainPage.jsp"/><inputtype="hidden"name="fld4"value="all"/><inputtype="hidden"name="provider"value="TIPassLoginSingleContainer"/><inputtype="hidden"name="ErrPage"value="https://myportal.ti.com:443/portal/dt?OKPage=http%3A%2F%2Fftds.ext.ti.com%2FWLTV%2FAppServlet%3Faction%3Dnull%26jspURL%3Djsp%2FAbout.jsp&provider=TIPassLoginSingleContainer"/></form></body></html>
点button后能够在IE打开这个网页,将id和password传给fld2和fld5这两个text,然后submit实现登录
解决方案四:
如果是webbrowser控件就很容易,要是外部的IE,就得用API把内容发送到IE的窗口中,估计只能模拟输入,而不能靠html来定位传值了
解决方案五:
在webbrowser上实现自动登陆后到了一个页面,该页面的代码如下<html><head><metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"><linkrel="stylesheet"href="/WLTV/css/ffwMenu/itsglobal/css/itsglobal.css"/><linkrel="stylesheet"href="/WLTV/css/ffwMenu/styles/ffw.css"/><linkrel="stylesheet"href="javascript/tabsSearch.css"type="text/css"><scripttype="text/javascript"src="javascript/tabMenu.js"></script><title>MainPagePage</title></head><bodyclass="dialogBody"><tableclass="dialogTable"width="700"><tr><tdclass="dialogTitleCell"> WaferLayoutandTWIFFViewer(WLTV)</td></tr><tr><tdclass="dialogCellB"style="padding:1em;">TheWaferLayoutandTWIFFViewerprovides:<ulstyle='margin-bottom:0px;margin-top:0px'><li>ValidationofformatandcontentofWaferConfigurationXMLandPCM_TWIFFASCIIruntimefiles.</li><li>VisualizationofawaferbasedontheWaferConfigurationinformationandpotentiallyincludinganoverlayofPCM_TWIFFruntimeinformation.</li></ul><br/>FromthispageeitheraWaferConfigurationorPCM_TWIFFruntimefile(orboth)canbeuploadedforvalidationandvisualization.Ifbothfiletypesareavailablemoreextensivevalidationandvisualizationoptionsareavailable.</td></tr><tr><td><tableborder='1'cellpadding='0'cellspacing='0'width='100%'><tr><td><?xmlversion="1.0"encoding="utf-8"?><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"lang="en"><head><title>XMLUPLOAD</title><scripttype="text/javascript"src="javascript/upload.js"></script><linkrel="stylesheet"href="/WLTV/css/ffwMenu/itsglobal/css/itsglobal.css"/><linkrel="stylesheet"href="/WLTV/css/ffwMenu/styles/ffw.css"/><scripttype="text/javascript"src="javascript/wltv.js"></script><scripttype="text/javascript"src="javascript/tabMenu.js"></script></head><bodyclass="dialogBody"><formid="uploadForm"name="uploadForm"action="Upload.jsp"enctype="multipart/form-data"method="post"><tableborder='0'cellpadding='0'cellspacing='0'width='95%'><tr><td> </td></tr><tr><tdwidth="40%"align="right"nowrap="true"style="padding-bottom:4px;"> WaferConfigurationfile: </td><tdwidth="60%"align="center"style="padding-bottom:4px;"><inputname="myInput"id="file1"type="file"size="65"onKeyDown='clearKeycode(this,event)'/></td></tr><tr><tdwidth="40%"align="right"nowrap="true"> PCM_TWIFFfile: </td><tdwidth="60%"align="center"><inputname="myInput"id="file2"type="file"size="65"onKeyDown='clearKeycode(this,event)'/></td></tr><tr><tdcolspan="2"align="center"style="padding-top:1em;padding-bottom:1em;"><inputclass="primary_button"style="margin-right:1em;"TYPE="Button"name='Upload'Value='Process'onClick='javascript:processElements("AppServlet?action=PerformContentValidation&jspURL=jsp/DisplayContent.jsp&exist=false")'><inputtype="reset"name="Reset"value="Reset"class="secondary_button"></td></tr></table></form></body></html></td></tr></table></td></tr></table></body></html>
在那个name是upload的button上点击后响应了onclick事件,然后上传file1和file2这2个input里的文件,自动跳出一个IE窗口显示结果。有办法把这个新跳出的IE窗口放在原先的webbrowser上显示吗?或者显示在新的webbrowser上
解决方案六:
哪位大神能帮帮忙吗?