Bagikan melalui


Objek My.Response

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

Komentar

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

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

Contoh

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