My.Request 对象
获取所请求的页面的 HttpRequest 对象。
注解
My.Request
对象包含当前 HTTP 请求的相关信息。
My.Request
对象仅适用于 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>
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈