
SaveAs | 355
HttpRequest
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Message.Text = Request.MapPath(VirPath, BasePath, BoolCross)
End Sub
Notes
In the previous example, if we had set the BoolCross variable to False and called the
example code from outside the QuickStart application, an HttpException would be
thrown, since this argument must be set to
True to map paths across applications.
SaveAs
Request.SaveAs(filename, includeHeaders)
Saves the current HTTP request to disk, using the filename argument as the path
and filename under which to save the request.
Parameters
filename
A String argument containing the path and filename under which the request
should be saved.
includeHeaders
A Boolean argument indicating whether to save the HTTP header informa-
tion as part of the request. Note that unless this is a POST request (or other
request type with a request body), no information is saved if this argument is
set to
False.
Example
The example writes the HTTP request headers to the browser (for comparison
purposes) and then saves the current request both with and without header
information:
Sub Page_Load( )
Message.Text = Request.Headers
' Save HTTP Request and Headers to a file
Request.SaveAs((Request.PhysicalApplicationPath & _
"HTTPRequest.txt"), True)
' Save HTTP Request to a file
Request.SaveAs((Request.PhysicalApplicationPath & ...