Share via


My.Request 物件

更新:2007 年 11 月

取得要求之頁面的 HttpRequest 物件。

備註

My.Request 物件會包含目前 HTTP 要求的相關資訊。

My.Request 物件僅可供 ASP.NET 應用程式使用。

範例

下列範例會取得 My.Request 物件的標頭集合,並使用 My.Response 物件將該集合寫入 ASP.NET 網頁。

<script >
    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>

請參閱

參考

My.Response 物件

HttpRequest