
396
|
Chapter 18: The HttpServerUtility Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Using "./HtmlEncode.aspx" for the Path returns the same physical path mapping
as in the original example.
The MapPath method dynamically determines whether the provided path is a
relative or virtual path based on whether the leading character is a slash (/) or
backslash (\). If the leading character is either one, the path is assumed to be a
complete virtual path. If not, the path is assumed to be relative to the physical
path of the currently executing page.
If the last component in
Path is a filename, the MapPath method does not verify
its existence. In other words, the code example returns the same absolute path
whether or not HtmlEncode.aspx exists.
A more flexible version of the MapPath method has been added to the Request
object that enables you to specify a base directory for resolving mappings and lets
you allow mapping of paths across different applications. You can read more
about the Request.MapPath method in Chapter 16.
Transfer
Server.Transfer(Path)
Server.Transfer(Path, preserveForm)
Discontinues execution of the current page and transfers execution to the page
specified by the
Path argument. This allows control of an application to be redi-
rected to the page specified by the
Path argument without any response being sent
to the client. ...