Last post Sep 12, 2008 04:18 AM by Nikhil Tripathi
Sep 12, 2008 02:21 AM|tim yap|LINK
I just want to know what is the difference between server.mappath and page.mappath?
I try to use this two by passing parameter like this
but both didn't work for me,.
thanks for any help
Sep 12, 2008 03:06 AM|HeartattacK|LINK
They both map a virtual path to a physical one.
So, if you have a folder named folder1 in your wesite root and that root is in C:\inetpub\www\site1, then:
string path = Server.MapPath("~/folder1");
will set path to C:\inetpub\www\site1\folder1
Sep 12, 2008 03:53 AM|tim yap|LINK
Sep 12, 2008 04:04 AM|HeartattacK|LINK
Server.MapPath is used to read the physical path of a virtual folder. There's nothing you can "set".
Sep 12, 2008 04:18 AM|Nikhil Tripathi|LINK
They both map a virtual path to a physical one..
Retrieves the physical path that a virtual path, either absolute or relative, or an application-relative path maps to..
Each file on a Web server has two ways of being accessed - through a virtual path and through a
physical path. The virtual path is the path one would enter into their browser's Address bar, for example:
The bold part of the URL above is referred to as the virtual path. The
physical path is the actual drive, directory, and filename of a particular file on
the Web server. For example, on your computer, if you run Windows 9X, your