Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to show a page that is password protected in Umbraco instead of redirecting the visitor to the login page when the useragent HTTP header has a custom string set?
I'm using an external search engine (Swiftype) that crawls my website but obviously password protected pages are not getting indexed. However, in the settings of the crawler I can set a custom useragent string. The problem is that I don't know how I should cancel the redirect to the login page. Any ideas?
I was able to solve it myself. Improvements/suggestions always welcome.
If you are going to use this code, don't forget to change the DocumentTypeAlias properties, the secret-crawler-useragent-id and TrySetTemplate(...)
public class CrawlerAccess : ApplicationEventHandler
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
PublishedContentRequest.Prepared += PublishedContentRequest_Prepared;
private void PublishedContentRequest_Prepared(object sender, EventArgs e)
var request = sender as PublishedContentRequest;
if (request.PublishedContent != null
&& request.InitialPublishedContent.DocumentTypeAlias == "article"
&& request.PublishedContent.DocumentTypeAlias == "loginPage"
request.PublishedContent = request.InitialPublishedContent;
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted