
328
|
Chapter 16: The HttpRequest Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
If ct = "application/x-www-form-urlencoded" Then
'Process form input
Message.Text = "Form data was submitted."
Else
Message.Text = "Content Type of request is: " & ct
End If
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="ContentType.aspx" method="POST">
<h3>Name:</h3>
<input type="text" name="name">
<input type="submit">
</form>
</body>
</html>
Notes
One potential use for this property is to ensure that the content type of the
request is what you expect it to be. This can help avoid wasting processor time
with invalid requests and prevent malicious users from attempting to forge
requests to your application that send unexpected content.
FilePath
stringvar = Request.FilePath
Returns a string containing the virtual path of the current client request. The
virtual path includes the name of the application root folder, any subfolders in the
request path, and the requested filename.
Parameter
stringvar
A string variable to receive the file path.
Example
The example displays the FilePath property to the user:
Sub Page_Load( )
Dim fp As String
fp = Request.FilePath
Message.Text = "The virtual path of the current request is: _
& "<strong>" ...