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
Running into issues using an action filter on a hijacked route - annoyingly, it works in some cases but not in all...
Normally looks like so:
public class FooBarController : DefaultController
public ActionResult FooBar(RenderModel renderModel)
var model = new FooBarViewModel(renderModel.Content);
public ActionResult AltFooBar(RenderModel renderModel)
var model = new AltFooBarViewModel(renderModel.Content);
Where the filter replaces some markup, the named actions allow different method per template name, and everything should work fine (and does, for some content types).
When it fails, I get a super helpful error => "Filtering is not allowed"
I'm at a loss as to why this works for some types and not others. The controller code runs fine, models are built and correct, but when execution hits the filter, it is null:
public override void OnResultExecuted(ResultExecutedContext filterContext)
if ( filterContext.Exception != null)
HttpResponseBase response = filterContext.HttpContext.Response;
ReplaceSpecificMarkupFilter filter = _replaceSpecificMarkupFilterCtor();
// response.Filter is sometimes null... It should not be.
response.Filter = new StreamFilterBase(response.Filter, filter.Filter);
Any legends have any amazing solutions?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted