My.Request 物件
取得所要求網頁的 HttpRequest 物件。
備註
My.Request 物件會包含目前 HTTP 要求的相關資訊。
My.Request 物件僅適用於 ASP.NET 應用程式。
範例
下列範例會取得 My.Request 物件的標頭集合,並使用 My.Response 物件將該集合寫入 ASP.NET 網頁。
<script runat="server">
Public Sub ShowHeaders()
' Load the header collection from the Request object.
Dim coll As System.Collections.Specialized.NameValueCollection
coll = My.Request.Headers
' Put the names of all keys into a string array.
For Each key As String In coll.AllKeys
My.Response.Write("Key: " & key & "<br>")
' Get all values under this key.
For Each value As String In coll.GetValues(key)
My.Response.Write("Value: " & _
Server.HtmlEncode(value) & "<br>")
Next
Next
End Sub
</script>