Route Handler in Orchard after a Post.

Topics: Customizing Orchard
May 30, 2013 at 9:50 PM
I have a scenario where I create a test page:
http://localhost/base/Test
Now, within this test page, I added a widget that is a module, let's call it Mod.Hw

Mod.Hw consist of a controller, HwController class as followed:
[Themed]
public class HwController : Controller {

       public ActionResult Index()
        {
            // viewModel = GetFromSomeServices();
            return new ShapeResult(this, Shape.Parts_HwPart(Model:viewModel));
        }

        public ActionResult DoSomeProcessing()
        {
            return RedirectToAction("Index");
        }
}
In my Views/Parts/HwPart.cshtml I have:
<div>
@using (Html.BeginFormAntiForgeryPost(Url.Action("DoSomeProcessing", "Hw", new {area = "Mod.Hw" }))) {
                <button type="submit">@T("Submit")</button>
}
</div>
Problem now is, the URL ends up being :
http://localhost/base/Mod.Hw/Hw (Actual Results returned - After post)
As apposed to retaining the original URL after a post:
http://localhost/base/Test (__Need to retain this structure. How to do this ?? __)
Coordinator
May 31, 2013 at 2:19 AM
Why?
May 31, 2013 at 3:16 AM
Are you asking "why is it a problem" or "why the url should stay as is" ?

Maybe I wasn't being clear, when I click on Submit, I know as part of the mvc routing it typically goes to ../[controller]/[action]/id/.
I'm asking if I can change this behavior ?
Coordinator
May 31, 2013 at 6:08 AM
You have complete control over the URLs through IRouteProvider. Look for existing implementations of the interface.