MasterPage and ContentPlaceHolder Path

MasterPage and ContentPlaceHolder Path

am 20.12.2007 19:41:00 von Paul

I have a master page and a ContentPlaceHolder page in a typical master page
imlpmentation.

Does anyone know the property or method that I can use to retrieve the file
path/location of the ContentPlaceHolder page?

RE: MasterPage and ContentPlaceHolder Path

am 20.12.2007 20:18:02 von MohamadElarabi

Did you mean the path of the Content page?
If that is what you meant then you would just get that normally from the
Request object regardless of whether you're in the Content page or the
MasterPage. The request object returns information regarding the web request
that the server is currently processing. One of many options is

Request.FilePath
Request.Path
Request.PhysicalPath

There are many "path" resolving properties in the Request object. Some of
these return Physical path as in "C:\MySites\MyApp\default.aspx" and some
return virtual paths like "\default.aspx"

If you want to resolve a Virtual path to a physical one then you would use
Page.MapPath method and pass it a virtual path like so

MyPhysicalPath = Page.MapPath(Request.FilePath)

Hope that helps.


--
Mohamad Elarabi
Lead Developer. MCTS, MCPD.


"Paul" wrote:

> I have a master page and a ContentPlaceHolder page in a typical master page
> imlpmentation.
>
> Does anyone know the property or method that I can use to retrieve the file
> path/location of the ContentPlaceHolder page?