Difference between Server.mappath and Page.resolveURL

  • Thread starter Thread starter SandyIsCool
  • Start date Start date
S

SandyIsCool

Hi,

Can any one let me know what is difference between Server.mappath and
Page.resolveURL and what are the situations we use them.

Thanks,
Sandy
 
The ResolveUrl method is designed to create a friendly URL for a given
resource. For example, when you have a control that references an image,
you'll want the image to be referenced correctly when that control is placed
within a page. The ResolveUrl will create the url in a friendly way that is
relative to the page instead of relative to the control.

The Server.MapPath is used to find the file system path for a given
resource. For example: Server.MapPath("web.config") may give something like
c:\inetpub\wwwroot\web.config. It's used when you're trying to work with
files from the server's file system, such as saving uploaded files, creating
files on the server, referencing file-based databases.
 
Back
Top