Results 1 to 3 of 3

Thread: Keep Session alive in ASP.NET Core Web API

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,305

    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

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: Keep Session alive in ASP.NET Core Web API

    Quote Originally Posted by usamaalam View Post
    Each function connects to the hsm, does something and logs out of the hsm.
    Muhammad Usama Alam
    What's the hsm?
    "Feel the force...read the source..."
    Utilities: POPFile DebugView Process Explorer Wireshark KeePass UltraVNC Pic2Ascii
    .Net tools & open source: DotNetNuke log4Net CLRProfiler
    My open source projects: Thales Simulator EFT Calculator System Info Reporter VSS2SVN IBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  3. #3
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,307

    Re: Keep Session alive in ASP.NET Core Web API

    Quote Originally Posted by usamaalam View Post
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width