Home
Active Server Pages (ASP)
MapPath
There are occasions when you do not want to put a literal drive mapping to an ASP page. You can get the path relative to the current web site (ASP execution directory) by using the MapPath method of the Server object. For example:

    <% = Server.MapPath("/")%>
      – returns web root directory: C:\inetpub\wwwroot

    <% = Server.MapPath("/scripts")%>
      – returns: C:\inetpub\wwwroot\scripts
URLEncode
The URLEncode method will convert quotes, spaces, other non-alphanumeric characters for URL use. For example:
    <% = Server.URLEncode("Dave's Sample")%>
      – returns: Dave%27s+%231Sample
HTMLEncode
The HTMLEncode method will convert quotes, spaces, other non-alphanumeric characters for HTML use. For example:
    <% = Server.URLEncode("<%Session.Abandon%>")%>
      – returns: &lt;%Session.Abandon%&gt;
ScriptTimeout
The default for ScriptTimeout is 90 seconds. If you have a script that has to execute over a modem on a slow phone line, for example, you may want to increase the value. For example:
    <% = Server.ScriptTimeout=180>
      – increases timeout to 180 seconds (3 min).