❔ ✅ ASP.NET Core - How to use same connection in different cshtml files
Stack Overflow
ASP.NET Core - How to use same connection in different cshtml files
I have a script block in my Layout cshtml file. In this script block, I am opening a connection for my signalR. I also have another cshtml file, which is "IndexNew". This file is created by
8 Replies
It's a new page, it reloads fully and entirely, so the old connection will close and another will open. That's how SSR sites work. Nothing short of turning your application into an SPA, fully or partially, will help.
You are using a framework where every user action triggers a complete reload of all client code
or at least every page change
that's the definition of how Server-Side-Rendering frameworks work
you cannot preserve state between pages
any state that is serializable can be serialized and sent to the new page, to be rebuilt
a SignalR connection is not that
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Thanks for information because of that I continue with creating new connection.
Please can someone help me with resources /videos on how i can build a rest book api using MvC Razor views?
Ask in #help or #help-0, not in other people's resolved topics
Ok. Noted
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.