MasterPage and ContentPlaceHolder Path



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

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



Mohamad Elarabi

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


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.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question