HttpResponse获取与 .Page. 关联的对象。 此对象允许向客户端发送 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>