Reputation: 628
I have got couple of idententical views. Lets say: (1) Obsolete Products (2) Live Products.
The UI is almost the same including the action methods these views call. Currently, I have gone with "status" based coding.
public ActionResult GetProducts(string productType, bool isObsolete)
{
//some common code...
//status passed from the view
return isObsolete ? View("ObsoleteProducts") : View("LiveProducts");
}
I don't want views to pass the status - isObsolete. Instead, action method should detect that which view has called me(action itself).
I dig into Request object and its properties, but it ofcourse has "...\GetProducts" as URI..
Upvotes: 0
Views: 1882
Reputation: 39807
You are kind of limiting yourself on options by asking that the view not actually pass any information back to let you know where the request came from.
That said, you most likely need to look at the UrlReferrer property of the request to see where the request originated from.
http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer.aspx
Upvotes: 2