ASP.Net/Request/Request Parameters

Материал из .Net Framework эксперт
Версия от 11:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Displaying a named request parameter in ASP.NET

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Displaying a named request parameter in ASP.NET</title>
   </head>
<body>
<p>
<%
   Response.Write(Request("name") & "<br><br>")
   Request.SaveAs(MapPath("file1.txt"), True)
   Dim length As Integer
   length = Request.ContentLength
   Response.Write("Length of request was: " & length & " bytes.")
%>
</p>
</body>
</html>



Showing Parameters via the Params Collection in ASP.NET

<%@ Page Language="vb" %>
<html>
   <head>
      <title>Showing Parameters via the Params Collection in ASP.NET</title>
   </head>
<body>

<%
Dim Counter1, Counter2 As Integer
Dim Keys(), subKeys() As String
Dim ParamColl As NameValueCollection
ParamColl=Request.Params
Keys = ParamColl.AllKeys
For Counter1 = 0 To Keys.GetUpperBound(0)
   Response.Write("Key: " & Keys(Counter1) & "<br>")
   subKeys = ParamColl.GetValues(Counter1) " Get all values under this key.
   For Counter2 = 0 To subKeys.GetUpperBound(0)
      Response.Write("Value " & CStr(Counter2) & ": " & subKeys(Counter2) & "<br>")
   Next Counter2
Next Counter1
%>

</body>
</html>