Created
October 9, 2017 12:52
-
-
Save sitefinitySDK/b5edfe9c3d0cd01b42217995f3c35a85 to your computer and use it in GitHub Desktop.
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3 - https://docs.sitefinity.com/mvc-change-the-response-status-of-the-custom-error-page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web; | |
using Telerik.Microsoft.Practices.Unity; | |
using Telerik.Sitefinity.Abstractions; | |
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing; | |
using Telerik.Sitefinity.Mvc; | |
using Telerik.Sitefinity.Services; | |
namespace SitefinityWebApp | |
{ | |
public class FeatherActionInvokerCustom : FeatherActionInvoker | |
{ | |
protected override void RestoreHttpContext(string output, HttpContext initialContext) | |
{ | |
this.PopulateResponseStatus(System.Web.HttpContext.Current, initialContext); | |
base.RestoreHttpContext(output, initialContext); | |
} | |
private void PopulateResponseStatus(HttpContext httpContext, HttpContext initialContext) | |
{ | |
if (!SystemManager.IsDesignMode && httpContext.Response.StatusCode != 200) | |
{ | |
initialContext.Response.Status = httpContext.Response.Status; | |
initialContext.Response.StatusCode = httpContext.Response.StatusCode; | |
initialContext.Response.StatusDescription = httpContext.Response.StatusDescription; | |
} | |
} | |
internal static void Register() | |
{ | |
ObjectFactory.Container.RegisterType<IControllerActionInvoker, FeatherActionInvokerCustom>(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment