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.
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
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.
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
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
Hi Kurniawan,
Removing the line
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
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
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
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,
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
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
is working on a reply...