I'm using ASP.NET MVC in Visual Studio 2015. The app has the following structure:
MyApp
Controllers
- Controller1
- Actions
- Create
- Delete
- Details
- Edit
- IndexPartial
- Actions
- Controller2
- Actions
- Edit
- Actions
- Controller3
- Actions
- Edit
- Actions
- Controller1
Views
- Controller1
- Create
- Delete
- Details
- Edit
- IndexPartial
- Controller2
- Edit
- Controller3
- Edit
- Controller1
The app displays Controller1/IndexPartial
view on the Controller2/Edit
view and on Controller3/Edit
. This partial view displays rows of data, each with Edit
, Details
, Delete
buttons which take the user to the Controller1
views for those actions.
When the user is done with the Controller1 action, they need to return to Controller2/Edit
or Controller3/Edit
via the Back to List
button or when the Save/Delete buttons are clicked. But how do we determine where the user originated? Did the user come from the Edit
of Controller2
or Controller3
?
We've thought of using a session variable. Can RouteConfig.cs
be used to track the user's path and help determine where s/he should return? How do we do this via routes in MVC?
Thank you for your help.
Update: This is all done via the server; no JavaScript (Angular, etc.).