View Detection or PartialView in Controller

In the controller, can I determine if I can "control" a view or a partial view?

I have a common controller that is between any controller and Controller , there are things that I would only like if it were a view, not a partial view.

Ideally, in protected override ViewResult View(...

+4
source share
2 answers

Check

ControllerContext.IsChildAction

in your action method or

filterContext.IsChildAction

in OnActionExecuted

+7
source

Have a different route for everyone. / home / about and / home / about / partial, which are both directed to the same controller method. Basically, instead of trying to sniff things, EXPRESS is explicitly through a route or parameter.

+1
source

All Articles