以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]设置默认网页的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=173321)

--  作者:洮沙
--  发布时间:2021/11/24 10:48:00
--  [求助]设置默认网页的问题

HttpRequest有以下代码:

 

Select Case e.Path
    Case "index.html",""    ’已经做好的网页

                                     ‘这个地方应该是什么代码?
End Select

 

浏览器测试:http://127.0.0.1/index.html正常显示,http://127.0.0.1 显示“foxtable web server has started(error 404).”

 

另外,有以下计划该如何实现:

 

一个项目同时开两个端口:“80”和“5505”,有两套源文件,分别放到WEB_80和WEB_5505文件中,

 

浏览器输入127.0.0.1直接指向WEB_80文件夹下index.html默认网页,

 

浏览器输入127.0.0.1:5505直接指向WEB_5505文件夹下index.html默认网页。

 

我看了帮助文件,感觉组织起来特别费劲,麻烦老师打个样,谢谢!

 

 

 


--  作者:有点蓝
--  发布时间:2021/11/24 11:17:00
--  

1、

Select Case e.Path
    Case "index.html",""    ’已经做好的网页

                                     ‘index.html原来是什么代码,这个地方就是什么代码?如果不行请贴出自己写的完整代码说明问题

End Select


如果使用的是静态网页

Select Case e.Path
    Case "" 

e.Redirect("index.html")

End Select


2、

方法1、

添加一个根目录,比如d:\\web,把WEB_80和WEB_5505都放入d:\\web,启动服务设置【HttpServer.WebPath = "d:\\web"


然后80端口的通过这样访问:http://www.abc.com/WEB_80/index.html

然后5505端口的通过这样访问:http://www.abc.com:5505/WEB_5505/index.html


方法2、使用自定义事件头,去掉HttpServer.WebPath = "d:\\web"


httprequest事件

Dim fl As String = "d:\\web\\WEB_80\\" & e.path

if e.port = 5505 then

fl = "d:\\web\\WEB_5505\\" & e.path

end if

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",".zip",".rar"
            e.WriteFile(fl)
            Return 
\'
这里必须返回
    End 
Select

End
 If

\'其它代码


--  作者:洮沙
--  发布时间:2021/11/24 11:24:00
--  
明白了,谢谢!