Dim fl As String = "d:\web\" & e.path
If e.path.Contains(":\") Then '注意路径分隔符是“\”,不是“/”,和下面网页中设置的相反
If FileSys.FileExists(e.path) Then
e.WriteFile(e.path)
Return
End If
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
Select Case e.Path
Case "test.htm"
Dim wb As New weui
wb.AddForm("","form1","test.htm")
With wb.AddInputGroup("form1","ipg1","客户资料")
.AddInput("姓名","姓名","text").value = "舒淇"
.AddInput("地点","地点","text").Value = "蒙古草原"
.AddInput("日期","日期","date").value = #10/12/2012#
With .AddUploader("up1","",True)
.AllowAdd = False '关闭文件上传功能
.AddImage("/f:/123.jpg") '绝对路径前加上斜杠/,注意路径分隔符是“/”,不是“\”
.AddImage("./images/002.jpg")
End With
End With
e.WriteString(wb.Build) '生成网页
End Select
注意使用这种用法后不能再启动服务的时候使用HttpServer.WebPath ,另外所有页面和文件都会进行绝对路径的判断校验,可能会导致一些性能问题。