C
C#15mo ago
batsky

❔ ✅ 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
Angius
Angius15mo ago
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.
JakenVeina
JakenVeina15mo ago
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
Accord
Accord15mo ago
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.
batsky
batsky15mo ago
Thanks for information because of that I continue with creating new connection.
dlaw_code
dlaw_code15mo ago
Please can someone help me with resources /videos on how i can build a rest book api using MvC Razor views?
Angius
Angius15mo ago
Ask in #help or #help-0, not in other people's resolved topics
dlaw_code
dlaw_code15mo ago
Ok. Noted
Accord
Accord15mo ago
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.