Keep Session alive in ASP.NET Core Web API
Hello Everybody,
I have a web api project developed in asp.net core that has a bunch of api functions. Each function connects to the hsm, does something and logs out of the hsm. What I need to do is to create the hsm connection once in the start of the application somewhere and keep using the connection in every api function. Is this possible?
Thanks,
Muhammad Usama Alam
Re: Keep Session alive in ASP.NET Core Web API
Quote:
Originally Posted by
usamaalam
Each function connects to the hsm, does something and logs out of the hsm.
Muhammad Usama Alam
What's the hsm?
Re: Keep Session alive in ASP.NET Core Web API
Quote:
Originally Posted by
usamaalam
Hello Everybody,
I have a web api project developed in asp.net core that has a bunch of api functions. Each function connects to the hsm, does something and logs out of the hsm. What I need to do is to create the hsm connection once in the start of the application somewhere and keep using the connection in every api function. Is this possible?
Thanks,
Muhammad Usama Alam
Would this connection to the HSM need to be done on a per user basis, or just once for the application? If it is just once you could probably open the connection on launch and then store it somewhere like either in a cache, or possibly create a singleton object.
Is there a reason why you need to maintain a single connection, rather than opening and closing a connection on each usage?