MarynBittner
New Member
Let's say, there is an area "Products" and two controller "Home" and "Suite" (there are more controllers that will behave in this scenario like "Suite").I configured the "ProductAreaRegistration.cs" so that the URLs will look like this: \[quote\] \Products\
(with controller = "Home", action = "Index") \Products\Suite
(with controller = "Suite", action = "Index") \Products\Suite\TechnicalSpecification
(with controller = "Suite", action = "TechnicalSpecification")\[/quote\]The action "TechnicalSpecification" appears in every controller of that area but the "Home" controller is the one, wo actually does the main work. The other controllers like "Suite" just do some controller related stuff and then redirect to "Home", "TechnicalSpecification":\[code\]// Suite-Controllerpublic ActionResult TechnicalSpecification(){ //doSomethingThatOnlyThisControllerHasToDo(); return RedirectToAction("TechnicalSpecification", "Home", new { specificationId = 45 });}\[/code\]\[code\]// Home-Controllerpublic ActionResult TechnicalSpecification(int specificationId) { Object model = getModelByIdWithSomeMethod(specificationId); //DoEvenMoreThingsHere(); return View(model); }\[/code\]My problem is, when I look at the link of "Suite", "TechnicalSpecification" it shows
\Products\Suite\TechnicalSpecificationbut after clicking that link the URL in the address bar changes to
\Products\TechnicalSpecification?specificationId=45because of the redirection. I would like the URL to stay like mentioned before.
So instead of "return RedirectToAction(...)" is there something like "return ViewResultFromOtherController(...)", so that it is not redirecting?
Hope you got the idea.
If not, please ask!
Thanks in advance!
(with controller = "Home", action = "Index") \Products\Suite
(with controller = "Suite", action = "Index") \Products\Suite\TechnicalSpecification
(with controller = "Suite", action = "TechnicalSpecification")\[/quote\]The action "TechnicalSpecification" appears in every controller of that area but the "Home" controller is the one, wo actually does the main work. The other controllers like "Suite" just do some controller related stuff and then redirect to "Home", "TechnicalSpecification":\[code\]// Suite-Controllerpublic ActionResult TechnicalSpecification(){ //doSomethingThatOnlyThisControllerHasToDo(); return RedirectToAction("TechnicalSpecification", "Home", new { specificationId = 45 });}\[/code\]\[code\]// Home-Controllerpublic ActionResult TechnicalSpecification(int specificationId) { Object model = getModelByIdWithSomeMethod(specificationId); //DoEvenMoreThingsHere(); return View(model); }\[/code\]My problem is, when I look at the link of "Suite", "TechnicalSpecification" it shows
\Products\Suite\TechnicalSpecificationbut after clicking that link the URL in the address bar changes to
\Products\TechnicalSpecification?specificationId=45because of the redirection. I would like the URL to stay like mentioned before.
So instead of "return RedirectToAction(...)" is there something like "return ViewResultFromOtherController(...)", so that it is not redirecting?
Hope you got the idea.
If not, please ask!
Thanks in advance!