Bagikan melalui


Objek My.Response

Mendapatkan objek HttpResponse yang terkait dengan Page. Objek ini memungkinkan Anda mengirim data respons HTTP ke klien dan berisi informasi tentang respons tersebut.

Keterangan

Objek My.Response berisi objek HttpResponse saat ini yang terkait dengan halaman tersebut.

Objek My.Response hanya tersedia untuk aplikasi ASP.NET.

Contoh

Contoh berikut mendapatkan koleksi header dari objek My.Request dan menggunakan objek My.Response untuk menulisnya ke halaman 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>

Lihat juga