Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jan 54 posts 74 karma points
    Oct 03, 2011 @ 13:50
    Jan
    0

    Content Placeholder - clever way to always show the first page ?

    Hello there -

    i got a masterpage that has a content place holder - where all future page content shows.

    but i would like for it to show if you go to the masterpage/default  (like if someone is directed to the site but not a page)

    that it shows the first page content if a page has not been picked.

    im thinking a macro places inside the content placeholder  but unsure what to do - its properly easy. but unfortunately im not very good with macros.

    Also. that when someone is looking on that page - that it actually reacts like that page is active "so you can see in the menu bar that a:active styles come into play?

    hope someone can help - thanx


  • Jon Boyer 37 posts 59 karma points
    Oct 04, 2011 @ 05:24
    Jon Boyer
    0

    Masterpages are just templates - they don't actually 'exist' as pages.

     

    If I understand you correctly, you seem to be wanting to direct someone to the home page if they try and enter an invalid URL.  If this is the case, you're better of setting this under .NET Error Pages in IIS.

     

     

  • Jan 54 posts 74 karma points
    Oct 04, 2011 @ 11:05
    Jan
    0

    ok ill try to explain.


    If someone was to type in / or just visit the site

    "TheSiteInQuestion.com"

    they would come to the site yes (the masterpage loads - but the content placeholder(on the masterpage template) is empty because no page has been chosen

    if someone typed in /or picked a page "TheSiteInQuestion.Com/page1.aspx"
    the mastertemplate would now show the site plus with the content place holder containing the page info.

    hope this explains  better.

    i just would like it that if someone where to goto the

    "TheSiteInQuestion"

    it would always pick the first page to fill in the contentplaceholder (or a specific page even)

  • Isis 21 posts 42 karma points
    Oct 05, 2011 @ 15:33
    Isis
    0

    Sounds to me like you just want to set a page as the home page; I am actually curious about how to do this also - as right now (weirdly) it just decides to load the first page based on an alphabetical sort, I believe, which reduces my "Home" page, usually accessed by the root URL, to my "About" page - which is utterly inconvenient - and there is no simple setting that is global in all page editors along the lines of "make homepage"...

    If anyone has any information on this, I would certainly be glad too.

     

    In the meantime, one thing I did come across was someone suggesting using URL rewriting (this is an absolute hack, but actually was more convenient to find on the web than a simple setting or tutorial is on the web about doing this "properly"), it didn't work for me (causing more problems than it was worth when a URL has a trailing slash) but you might wish to play with it:

    <add name="homepagerewrite"
            virtualUrl="~/$"
            rewriteUrlParameter="ExcludeFromClientQueryString"
            destinationUrl="~/home"
            ignoreCase="true" />
Please Sign in or register to post replies

Write your reply to:

Draft