
336
|
Chapter 16: The HttpRequest Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Parameter
intvar
An Integer variable to receive the size, in bytes, of the current request body.
Example
The example writes the TotalBytes property to the browser:
Sub Page_Load( )
Dim intvar As Integer
intvar = Request.TotalBytes
Message.Text = "The size of the current request body is: <br/>"
Message.Text &= intvar & " bytes."
End Sub
The following code can be used to post to the example page:
<html>
<head>
<title>Submit a named parameter via POST</title>
</head>
<body>
<form id="form1" action="TotalBytes.aspx" method="POST">
<h3>Name:</h3>
<input type="text" name="name">
<input type="submit">
</form>
</body>
</html>
Notes
This property’s behavior is identical to that of the ContentLength property
described earlier in this chapter.
Url
uriObj = Request.Url
Returns an instance of the Uri class containing properties that describe the current
URL requested by the user. Properties exposed by the
Uri class include Scheme
(protocol), Port, and Host.
Parameter
uriObj
An Object variable of type Uri.
Example
The example uses the Uri object that the Url property returns to write informa-
tion about the URL for the current request to the browser:
Sub Page_Load( )
Dim myUri As Uri
myUri = Request.Url
Message.Text = "Current request URL info - <br/><br/>"