Hi all!
I have implemented a method that checks if the previous page is of a specific pagetype. It works perfectly in our stage environment but not in production. I have checked that the property PreviousPageUrl is not an empty string in production. So it can’t be that. It has to be when it tries to get the contentreference for the page where it fails. Have I missed something? The only difference between the two environments that I can think of is that the stage environment is closed. You only access it by login into it.
Br/Isabel
public static string PreviousPageUrl
{
get
{
var urlRef = System.Web.HttpContext.Current.Request.UrlReferrer;
if (urlRef != null)
{
return new UrlBuilder(urlRef.AbsoluteUri).ToString();
}
return string.Empty;
}
}
public static string GetPreviousUrlsPageType()
{
if (string.IsNullOrEmpty(PreviousPageUrl)) return string.Empty;
var contentRef = UrlResolver.Current.Route(new UrlBuilder(PreviousPageUrl));
if (contentRef != null)
{
var page = ContentRepository.Get<PageData>(contentRef.ContentLink);
if (page is FloorGuideBasePageType)
{
return PageTypes.FloorGuidePage;
}
if (page is ProductAccessoryDetailPageType)
{
return PageTypes.ProductAccessoryDetailPageType;
}
}
return string.Empty;
}