C
C#2y 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
Angius2y 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
JakenVeina2y 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
Accord2y 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
batskyOP2y ago
Thanks for information because of that I continue with creating new connection.
dlaw_code
dlaw_code2y ago
Please can someone help me with resources /videos on how i can build a rest book api using MvC Razor views?
Angius
Angius2y ago
Ask in #help or #help-0, not in other people's resolved topics
dlaw_code
dlaw_code2y ago
Ok. Noted
Accord
Accord2y 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.
Want results from more Discord servers?
Add your server