21 September 2014

Server.MapPath in Asp.Net

The  MapPath  method maps the specified relative or virtual path to the corresponding physical directory on the server.

Calling the server.mapPath() in aspx page :
1.      <%= Server.MapPath("main.asp")%>
It will result in displaying on the screen address of this file -  C:\Inetpub\wwwroot\Application\main.asp
2.      <%= Server.MapPath(".")%>
Output : C:\Inetpub\wwwroot\Application. 
3.       <%= Server.MapPath("/")%>
Output :  C:\Inetpub\wwwroot
               


For more information :


The MapPath method returns the ASP 0173 error, "Invalid Path Character", if the Path parameter contains any of the following characters:
·         Asterisk (*)
·         Question mark (?)
·         Angle brackets (< or >)
·         Comma (,)
·         Colon or semi-colon (: or ;)
·         Single-quote or double-quote (' or ")
·         Right square bracket (])
·         Double slashes (// or \\)

No comments:

Post a Comment