Copied to clipboard

Flag this post as spam?

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


  • Kurniawan Kurniawan 202 posts 225 karma points
    Aug 25, 2010 @ 04:57
    Kurniawan Kurniawan
    0

    Restrict website user to access the template in url

    I just notice that website user can access the template by using the name / alias of the template.

    for example.

    I have Site1 Template. and when I call http://localhost/Site1. It return me a page...
    But I want it to be 404 page because I don't have any node which called Site1.

     

    Is that possible ?

     

    Thanks

  • Kurniawan Kurniawan 202 posts 225 karma points
    Aug 25, 2010 @ 08:57
    Kurniawan Kurniawan
    0

    I find this on 404Handler.config.

    <notFound assembly="umbraco" type="SearchForTemplate"/>


    I thought it gonna solve my problem..

    But It seems it doesn't work as well.. any one know what it is for ?

    or face the same thing like me ?

     

    Thanks

  • Matt Brailsford 4124 posts 22221 karma points MVP 9x c-trib
    Aug 25, 2010 @ 09:36
    Matt Brailsford
    0

    Hi Kurniawan,

    Removing the line

    <notFound assembly="umbraco" type="SearchForTemplate"/>

    from your 404Handler.config should prevent /aliasName style urls from resolving (You may need to restart your app pool for it to take effect). I'm not sure to what detriment this would be though, so might be worth testing first.

    This would obviously mean that you can't use alternative templates via the /aliasName method anymore, so if you did need to use alternative templates, you'd have to use the querystring method

    http://www.mydomain.com/?altTemplate=aliasName

    Matt

  • Kurniawan Kurniawan 202 posts 225 karma points
    Aug 25, 2010 @ 11:57
    Kurniawan Kurniawan
    0

    Thanks Matt,

     

    How If I don't want user to access my master page ?

    http://localhost/site1

    I don't have node called site1 but I have template called site1.

    Any clue ?

     

    Thanks

  • Matt Brailsford 4124 posts 22221 karma points MVP 9x c-trib
    Aug 25, 2010 @ 12:07
    Matt Brailsford
    0

    Hi Kurniawan,

    This is a built in feature in Umbraco called "alternative templates", it allows you to request a page (in your case the homepage) but instruct Umbraco to use a different template than that defined in the Document Type.

    Basically, if you have a page:

    http://www.mysite.com/mypage.aspx

    You can get it to use an alternative template using the following sytax

    http://www.mysite.com/mypage/mytemplatealias.aspx

    or

    http://www.mysite.com/mypage.aspx?altTemplate=mytemplatealias

    So by default, Umbraco will try and resolve the page, and if it doesn't exist, will then see if you were requesting an alternative template instead.

    Matt

  • Kurniawan Kurniawan 202 posts 225 karma points
    Aug 25, 2010 @ 12:20
    Kurniawan Kurniawan
    0

    Oh.. I understand now...

    so in my cases...if I call http://localhost/site1

    and I don't have node called site1... it try to load.. "my homepage" with Site1 template...

    ---

    Thanks Matt,

     

  • Kurniawan Kurniawan 202 posts 225 karma points
    Aug 25, 2010 @ 12:23
    Kurniawan Kurniawan
    0

    How about profiler ?

    <notFound assembly="umbraco" type="SearchForProfile"/>

    ====

    I try this .. but doesn't work...

    http://localhost:2117/profiler/test6.aspx

    http://localhost:2117/profiler/test6

    I have user called test6

     

    Thanks

  • Matt Brailsford 4124 posts 22221 karma points MVP 9x c-trib
    Aug 25, 2010 @ 12:24
    Matt Brailsford
    0

    Hi Kurniawan,

    I'm not 100% on how the SearchForProfile one works, all I could suggest is to look through the source to see what it does.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft