Page Lifecycle ASP.Net Tutorial

< html>
   
      Submit a named parameter via POST
   

   
      

Name:


      
      
   


File: NextPage.aspx
<%@ Page Language="vb" %>
<%@ import namespace = "System.IO" %>

   
      Filtering the HTTP Request body using InputStream
   

<%
Dim intvar As Integer
intvar = Request.TotalBytes
Response.Write("The size of the current request body is: 
")
Response.Write(intvar & " bytes.
")
Dim InStream As Stream
Dim iCounter, StreamLength, iRead As Integer
Dim OutString As String
Dim Found As Boolean
InStream = Request.InputStream
StreamLength = CInt(InStream.Length)
Dim ByteArray(StreamLength) As Byte
Trace.Write("StreamLength", StreamLength)
iRead = InStream.Read(ByteArray, 0, StreamLength)
For iCounter = 0 to StreamLength - 1
   If Found = True Then
      OutString = OutString & Chr(ByteArray(iCounter))
   End If
   If Chr(ByteArray(iCounter)) = "A" Then
      Trace.Write("Found", "Found an 'A'")
      Found = True
      OutString = OutString & Chr(ByteArray(iCounter))
   End If
   Trace.Write("Loop Number", iCounter)
   Trace.Write("CurrentChar", Chr(ByteArray(iCounter)))
Next iCounter
Response.Write("Output: " & OutString)
%>