Classic ASP Server Object

Last updated: August 26, 2026.

The ASP Server object supplies encoding, path mapping, component creation, execution, and error helpers.

Common safe uses

<%
Dim value, physicalPath
value = Request.QueryString("value")
physicalPath = Server.MapPath("/App_Data/report.txt")

Response.Write Server.HTMLEncode(value)
Response.Write "<br>Encoded URL: " & Server.URLEncode(value)
%>

Important methods

MethodPurpose
HTMLEncodeEncode text for HTML output
URLEncodeEncode a URL component
MapPathMap a virtual path to a physical path
CreateObjectCreate an installed COM component
GetLastErrorRead the current ASP error on an error page

Use fixed virtual paths with MapPath and do not create component names or filesystem paths from request input.

admin

admin

Leave a Reply

Your email address will not be published.