4
votes

I am trying to implement the custom login/ change password / forgot password functionality in Sitecore 7.1 using MVC. I am using Sitecore api to achieve this.

I am following the below mentioned blog, http://www.bolaky.net/post/Implementing-Sitecore-Extranet-login-on-a-website.aspx.

When I assign an anonymous user restricted it just shows me page not found but ideally it should redirect to my custom login page.

How should I go about it?

1
Please see below given answer I hope it will work for you. - Yogesh Sharma
Link is dead :( - Don Cheadle
Can you update your question or post an answer containing how you handled the actual login form submit and then redirecting the user to where they originally requested? - Don Cheadle

1 Answers

4
votes

To redirect anonymous user to login page. Please add loginPage="your custom login page URL" attribute in your site setting.

Please see below example I have added loginPage attribite at last -

<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" enableAnalytics="true" loginPage ="login.aspx"/>

With the help of this attribute in case of anonymous user will come on your site and if he doesn't have permission for any page then he will redirect to the login page which you have defined in site setting.