Dela via


My.Request-objekt

Hämtar objektet HttpRequest för den begärda sidan.

Kommentarer

Objektet My.Request innehåller information om den aktuella HTTP-begäran.

Objektet My.Request är endast tillgängligt för ASP.NET program.

Exempel

I följande exempel hämtas rubriksamlingen My.Request från objektet och objektet används My.Response för att skriva den till sidan 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>

Se även