SignalR - Preserve Same Connection Across Multiple Pages of Web Application
asp.net-mvc, signalr
Solution
Each page is represented as a "Client" so therefore you will have a unique connection per page (no way around that). Alternatives to this issue are:
- Dynamically load pages and display them on current page. Essentially only having one physical page.
- Save user state in a cookie or session and when you start a new connection fill it with your saved state. Be wary of security issues with this approach.
Hope this helps!
Problem
I'd like to provide a user experience where a SignalR connection is available across multiple pages in my ASP.NET MVC application. If I include SignalR startup code (JS) in my _Layout.cshtml, will that be perceived by the server as a "fresh" client connection every time the user navigates to a different page? Or will SignalR support this kind of behavior out of the box?