專案中建立一個【App_Browsers】的資料夾(可以透過VS裡面新增ASP.NET資料夾來做),裡面建立一個檔案,命名為【Chrome.browser】,而它的內容是一個XML的格式,內容如下:
<browsers>
<browser
refID="safari1plus">
<controlAdapters>
<adapter
controlType="System.Web.UI.WebControls.Menu" adapterType=""
/>
</controlAdapters>
</browser>
</browsers>
在 ASP.NET Web 網頁中偵測瀏覽器類型 參考
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String = ""
With Request.Browser
s &= "Browser Capabilities" & vbCrLf
s &= "Type = " & .Type & vbCrLf s &= "Name = " & .Browser & vbCrLf
s &= "Version = " & .Version & vbCrLf
s &= "Major Version = " & .MajorVersion & vbCrLf
s &= "Minor Version = " & .MinorVersion & vbCrLf
s &= "Platform = " & .Platform & vbCrLf
s &= "Is Beta = " & .Beta & vbCrLf
s &= "Is Crawler = " & .Crawler & vbCrLf
s &= "Is AOL = " & .AOL & vbCrLf
s &= "Is Win16 = " & .Win16 & vbCrLf
s &= "Is Win32 = " & .Win32 & vbCrLf
s &= "Supports Frames = " & .Frames & vbCrLf
s &= "Supports Tables = " & .Tables & vbCrLf
s &= "Supports Cookies = " & .Cookies & vbCrLf
s &= "Supports VBScript = " & .VBScript & vbCrLf
s &= "Supports JavaScript = " & _
.EcmaScriptVersion.ToString() & vbCrLf
s &= "Supports Java Applets = " & .JavaApplets & vbCrLf
s &= "Supports ActiveX Controls = " & .ActiveXControls & _
vbCrLf
End With
TextBox1.Text = s
End Sub
Dim s As String = ""
With Request.Browser
s &= "Browser Capabilities" & vbCrLf
s &= "Type = " & .Type & vbCrLf s &= "Name = " & .Browser & vbCrLf
s &= "Version = " & .Version & vbCrLf
s &= "Major Version = " & .MajorVersion & vbCrLf
s &= "Minor Version = " & .MinorVersion & vbCrLf
s &= "Platform = " & .Platform & vbCrLf
s &= "Is Beta = " & .Beta & vbCrLf
s &= "Is Crawler = " & .Crawler & vbCrLf
s &= "Is AOL = " & .AOL & vbCrLf
s &= "Is Win16 = " & .Win16 & vbCrLf
s &= "Is Win32 = " & .Win32 & vbCrLf
s &= "Supports Frames = " & .Frames & vbCrLf
s &= "Supports Tables = " & .Tables & vbCrLf
s &= "Supports Cookies = " & .Cookies & vbCrLf
s &= "Supports VBScript = " & .VBScript & vbCrLf
s &= "Supports JavaScript = " & _
.EcmaScriptVersion.ToString() & vbCrLf
s &= "Supports Java Applets = " & .JavaApplets & vbCrLf
s &= "Supports ActiveX Controls = " & .ActiveXControls & _
vbCrLf
End With
TextBox1.Text = s
End Sub
ASP FileUpload上傳多個檔案
ASP
<asp:FileUpload ID="FileUpload_addFile" Font-Size="12px" multiple runat="server" />
<asp:Button ID="But_addFileUp" runat="server" Font-Size="12px" Text="上傳" />
<asp:Button ID="But_addFileUp" runat="server" Font-Size="12px" Text="上傳" />
VB
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hfc As HttpFileCollection = Request.Files
For i As Integer = 0 To hfc.Count - 1
hfc(i).SaveAs("~/file/")
Next
End Sub
Dim hfc As HttpFileCollection = Request.Files
For i As Integer = 0 To hfc.Count - 1
hfc(i).SaveAs("~/file/")
Next
End Sub
1
沒有留言:
張貼留言