I had a redirect page on umbraco 8 with the following template
@using Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.RedirectPage>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
Layout = "Master.cshtml";
var links = Model.Value<IEnumerable<Link>>("linkTarget");
if (links != null && links.Any())
{
var prettyLink = links.FirstOrDefault();
Response.RedirectPermanent(prettyLink.Url);
}
}
The document type had a URL picker which if you loaded up that page it would redirect you to x page. For some reason this isnt working in Umbraco 10, has something changed?
Thanks for getting back to me, unfortunately I'm getting the following now.
HttpResponse' does not contain a definition for 'RedirectPermanent' and no accessible extension method 'RedirectPermanent' accepting a first argument of type 'HttpResponse' could be found (are you missing a using directive or an assembly reference?)
Redirect Template page
Hi all,
I had a redirect page on umbraco 8 with the following template
The document type had a URL picker which if you loaded up that page it would redirect you to x page. For some reason this isnt working in Umbraco 10, has something changed?
Thanks
Matt
Hi Matt,
try adding a return statement after the redirect.
Thanks for the reply, Unfortnetly still no joy. doesn't redirect :(
I get the following
The name 'Response' does not exist in the current context
It should be Context.Response
Hello Huw
Thanks for getting back to me, unfortunately I'm getting the following now.
HttpResponse' does not contain a definition for 'RedirectPermanent' and no accessible extension method 'RedirectPermanent' accepting a first argument of type 'HttpResponse' could be found (are you missing a using directive or an assembly reference?)
Thanks
try this
Sorry Huw still no joy, I thought it would be simple :(
Non-invocable member 'HttpContext.Response' cannot be used like a method.
where exactly are you trying to do this?
Could you show some more of your code maybe.
Hi Huw,
So I have a doc type in my compositions page called "Redirect Page" inside that I have a url picker.
Attached to the doc type is a template currently with the following;
sorry, my typo :)
Hi,
This code works fine but how can I get it to open in a new window?
Thanks
is working on a reply...