以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 网络服务问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157436) |
-- 作者:gudao123456 -- 发布时间:2020/10/16 2:20:00 -- 网络服务问题 网络服务设置: HttpServer.Prefixes.Add("http://127.0.0.1:8080/") HttpServer.WebPath = "d:\\web" \'指定静态文件存储位置 HttpServer.Start() test.htm 如下: <HTML> <HEAD> <meta http-equiv="Content-Type" c/> <meta http-equiv="X-UA-Compatible" c> <meta http-equiv="X-UA-Compatible" c > <TITLE>测试</TITLE> </HEAD> <BODY >
<form action=\'accept.htm\' enctype=\'multipart/form-data\' method=\'post\' id=\'form1\' name=\'form1\'>
<input type=\'text\' name="sfzhm" id="sfzhm" />
<input type=\'submit\' name=\'sumbit\' id=\'sumbit\' value=\'提交\'>
<input type=\'reset\' name=\'reset\' id=\'reset\' value=\'重置\'>
<form/> </BODY> </HTML> HttpRequest 代码如下: Dim fl As String = "d:\\web\\" & e.path If filesys.FileExists(fl) Dim idx As Integer = fl.LastIndexOf(".") Dim ext As String = fl.SubString(idx) Select Case ext Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".doc",".docx",".xls",".xlsx",".pdf" e.WriteFile(fl) End Select End If Select Case e.Path Case "accept.htm" Dim sb As New StringBuilder sb.AppendLine("接收到的数据有:<br/><br/>") For Each key As String In e.Values.Keys sb.AppendLine(key & ":" & e.Values(key) & "<br/>") Next Dim dr As DataRow = DataTables("表A").AddNew() dr("身份证号码")=e.postvalues("sfzhm") e.WriteString("读入成功 " & sb.ToString) End Select 直接在本机点击打开网页test.htm 运行正常 设置窗口和打开网页按钮 窗口按钮代码如下: Dim brw As WinForm.WebBrowser = e.Form.Controls("WebBrowser1") brw.Address ="d:\\web\\test.htm" 但,点击按钮后,test.htm网页打开正常,但点击提交后,得到的结果是 网页无法打开(估计是accept.htm无法打开) 是和原因?如何解决?谢谢! |
-- 作者:有点蓝 -- 发布时间:2020/10/16 8:50:00 -- brw.Address ="http://127.0.0.1:8080/test.htm" 另外如果使用了HttpServer.WebPath,事件头代码可以去掉:http://www.foxtable.com/mobilehelp/topics/0276.htm
|
-- 作者:gudao123456 -- 发布时间:2020/10/16 14:55:00 -- 谢谢! |