YouTip LogoYouTip

Met Mappath

# ASP MapPath Method * * Complete Server Object Reference Manual](#) * * * The MapPath method maps the specified path to the corresponding physical path on the server. **Note:** This method cannot be used in Session.OnEnd and Application.OnEnd. ## Syntax Server.MapPath(path) | Parameter | Description | | --- | --- | | path | Required. The relative or absolute path to map to a physical path. If the parameter starts with / or , the full virtual path is returned. If the parameter does not start with / or , the path relative to the .asp file being processed is returned. | ## Examples ### Example 1 For example, the file test.asp is located at C:InetpubwwwrootScript. The file Test.asp (located at C:InetpubwwwrootScript) contains the following code: <% response.write(Server.MapPath("test.html") & "
") response.write(Server.MapPath("script/test.html") & "
") response.write(Server.MapPath("/script/test.html") & "
") response.write(Server.MapPath("script") & "
") response.write(Server.MapPath("/") & "
") response.write(Server.MapPath("") & "
") %> Output: c:inetpubwwwrootscripttest.html c:inetpubwwwrootscriptscripttest.html c:inetpubwwwrootscripttest.html c:inetpubwwwrootscript c:inetpubwwwroot c:inetpubwwwroot ### Example 2 How to use a relative path to return the relative physical path to the page currently being viewed in the browser: Or: * * Complete Server Object Reference Manual](#)
← Met TransferMet Htmlencode β†’