hi,
what is the use of server.mappath().
what is the return value of this method.
Thanks in advance.
hi,
what is the use of server.mappath().
what is the return value of this method.
Thanks in advance.
The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.
returns string
Thank you for your answer.
But I couldn't get the concept relative or vortual path.Could you please describe it for me.
Thanks in advance.
The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.
It returns the physical path of the file or directory from the virtual path. As we setup a site in a remote server we don't have access to the server root path of our site in case of shared hosting. As our site is stored inside a particular folder of the server and by browser or by ftp access we can't move upward to wards the root of the server so it is not possible to get the physical path of any directory or file. Some of the objects like FileSystemObject requires physical path to handle various file and directory related commands. So here we can convert a virtual address of path to physical path by using Server MapPath method.
HI,
Why you do not try with below code:
Response.Write(Server.MapPath("any folder name within the root"));
Hope now you can understand.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.