共用方式為


My.Response 物件

取得與 Page 相關聯的 HttpResponse 物件。 這個物件允許您傳送 HTTP 回應資料給用戶端,並包含該回應的資訊。

備註

My.Response 物件包含目前與頁面相關聯的 HttpResponse 物件。

My.Response 物件只能用於 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>

請參閱

參考

My.Request 物件

HttpResponse