
MapPath | 395
ServerUtility
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Notes
This method is great for displaying the source of a page for educational purposes.
It is also particularly useful for encoding text entered by users that may or may
not be displayed or written to the browser. Without this encoding (or some form
of filtering or validation of the input), it might be possible for the user to enter
script or other code that the browser or server could execute. This possibility
could pose a very large security risk.
Whether with HtmlEncode or with some form of filtering or validation, you
should always ensure that text entered by your users that will be used or displayed
by your application does not contain unexpected characters or content.
Like the HtmlDecode method, HtmlEncode is overloaded. It returns a string
when called with the
s argument alone, and it does not return a value when called
with both an
s and an output argument. Instead, it sends the encoded HTML to
the
output class instance.
MapPath
PhysicalPath = Server.MapPath(Path)
Returns a string containing the physical path in the server’s filesystem that corre-
sponds to the virtual or relative path specified by the
Path argument.
Parameters
PhysicalPath
A String variable to receive the physical path from the method.
Path
A String variable containing the virtual or relative ...