tags:

views:

57

answers:

1

In a controller can I detect if I'm "controlling" a View or a partial view?

I have a shared controller that sits between any controller and Controller, there are things I would only like to happen if its a View rather than a partial view.

Ideally in protected override ViewResult View(...

Thanks, Nath

A: 

Have a different route for each. /home/about and /home/about/partial that both are routed to the same controller method. Basically, rather than trying to sniff around for things, EXPRESS it explicitly, through a route, or parameter.

Scott Hanselman
Any thoughts on a different approach for a legacy code base?
DeletedAccount
"legacy" using ASP.NET MVC? How is your code already legacy?
Chris Pietschmann
because its huge and I don't fancy retro fitting something that involves changing every route in the solution.
DeletedAccount