MasterPage and ContentPlaceHolder Path

Discussion in 'ASP .Net' started by Paul, Dec 20, 2007.

  1. Paul

    Paul Guest

    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?
     
    Paul, Dec 20, 2007
    #1
    1. Advertising

  2. 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?
     
    Mohamad Elarabi, Dec 20, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sebastian Meier
    Replies:
    0
    Views:
    423
    Sebastian Meier
    Apr 23, 2005
  2. Sebastian Meier
    Replies:
    1
    Views:
    907
    TDAVISJR
    Apr 25, 2005
  3. Greg
    Replies:
    4
    Views:
    14,941
    dassyms
    Apr 17, 2006
  4. Andrew Robinson

    Masterpage ContentPlaceHolder within quotes?

    Andrew Robinson, Jun 3, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    865
    Walter Wang [MSFT]
    Jun 5, 2006
  5. Greg
    Replies:
    1
    Views:
    227
    Ward Bekker
    Mar 23, 2006
Loading...

Share This Page