Hi danroth27. First of all, thank you for reviewing my feature request!
Answer question 1:
For example, you create an webapp where you have a list of entities and a edit/create page. And the user wants to edit multiple entities at the same time. (Multiple browser windows/tabs)
If you save the current entity which was selected for editing in the session, the session value will be overriden when the user opens a second/third... entity in another window/tab. That means, you can edit only on (This is an example of an simple scenario. I know, it's possible to solve this Scenario without sessions. But if the edit window is much bigger with multiple sites it can make sense to store the data in the sesion until the users saves the chnges.)
Answer question 2:
It's a good question. First I wanted to create a Little NuGet package for this. But an conversational session must always have an identifier. This identfier must be added to every generated link (@Html.ActionLink(...))
or form action attribute. It can be done be the developer, but it's nicer when the MVC Framework adds the identifier param on it's own (when it's needed).
We can't know how your end-users are working with our web applications. Advanced users may use multiple tabs/windows. (As explained in answer 1). I think, it's a common problem.
Benefits with conversational session:
- In case when data is stored in the session and must not be changed by another window/tab.
In every situation where you may have like a "process". (Multiple sites for a specific use case.) At the end of the use case the conversational session can be cleared and we can be sure
that we have cleared all use case related data (AND only the related data).
How I plan to implement it:
I forked the ASP.NET MVC source code and did a little POC.
This is how it could work. (Basic example)
public class HomeController : Controller
public ActionResult Index()
if (this.Conversation["abc"] == null)
this.Conversation["abc"] = "test";
public ActionResult SiteTwo()
var conv = this.Conversation["abc"]; // conv is not empty/null
[Conversation(End = true)]
public ActionResult End()
var conv = this.Conversation["abc"]; // Conv is not empty/null BUT after the execution of this action the conversation will be cleared (check attribute)
The this.Conversation property stores the data in the this.Session property under a specific key-nameing. (It would be cool to handle everything over this.Session. But for this, we need to create a new class which derives from HttpSessionStateBase. I think that has a too big inpact on the framework + exists web applications.)
In this basic example you don't see all features. I don't have the complete feature list yet.
But for example, it must be possible to define the scope of the conversation. The example above is shows a controller-scoped conversation. But a scope can be over multiple controllers.
--> [Conversation(Scope="Ordering")] Just an example.
- By default, when setting up an conversation everything should work by itself. The developer doesn't have to take care about the links generated in the view.
Exception: If the view has custom links or ajax calls, then it should be possible to access the current conversation identifier over the view engine. So that the developer can attach the identifier in the custom links.
What does it mean for MVC?
- Conversational session doesn't have a big impact on the framework. The ConversationAttribute is a filter. That means, only when the developer works with conversations the conversation-logic will be executed. (Like OutputCache for example)
The html link/form generator must be modified. I did it already in my POC. I solved it with 2-5 lines of code.
That should be enough for now :)