Restrict direct access to cmspages

Rajesh kannan Muthu asked on January 6, 2022 04:15

Team, How do i restrict access to follwoing files CMSModules/MessageBoards/CMSPages/Message_Edit.aspx CMSModules/Membership/CMSPages/ResetPassword.aspx
have tried the following
<<location path="CMSModules/MessageBoards/CMSPages/Message_Edit.aspx"-->
<system.webServer> </system.webServer> </location--> based on
https://docs.xperience.io/k81/securing-websites/deploying-websites-to-a-secure-environment/disabling-unnecessary-modules-and-services-and-keeping-the-system-up-to-date
still able to access the page and cannot restrict access.
Any suggestions welcome.
thanks Raj

Recent Answers


vasu yerramsetti answered on January 6, 2022 05:27

Try the following code snippet for restrict specific pages -

 <location path="CMSModules/MessageBoards/CMSPages/Message_Edit.aspx">
<system.webServer>
    <security>
        <authorization>
            <remove users="*" roles="" verbs="" />
            <add accessType="Allow" users="" roles=""/>
        </authorization>
    </security>
</system.webServer>
</location>
<location path="CMSModules/Membership/CMSPages/ResetPassword.aspx">
<system.webServer>
    <security>
        <authorization>
            <remove users="*" roles="" verbs="" />
            <add accessType="Allow" users="" roles=""/>
        </authorization>
    </security>
</system.webServer>
</location>

Reference : https://docs.xperience.io/k11/securing-websites/deploying-websites-to-a-secure-environment/restricting-access-to-directories

0 votesVote for this answer Mark as a Correct answer

Rajesh kannan Muthu answered on January 10, 2022 05:26

Hi Thanks Vasu, i tried what you have suggested already and did not work. i tried adding inside CMSModules folder web.config and in root site web.config no luck

0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on January 10, 2022 10:56

Please try with add this on root web.config only and not required to add this web.config under CMSModules.

I have tested this Kentico 12 and working fine.

Let me know if you are getting any error.

0 votesVote for this answer Mark as a Correct answer

Rajesh kannan Muthu answered on January 13, 2022 11:36

Sorry for delay. not getting any error or event but able to reach page.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.