I've been working on a web application (for the main part to be used on an internal intranet but in some instance to be accessed via the internet).
I'm using Visual Studio ASP.NET (with C# code).
I had been developing it in such I way that I was saving the SqlConnection in the 'Session' object (with the object primed with the connection string consisting of the server-name, database-name, etc).
However it was suggested to me by a colleague that this was not a good move and he instead suggested I create the connection as required, creating the connection string in each instance.
My question is this :
- How sensible is it to store a SqlConnection object in the 'Session' object ?
- Should I be managing this practise in some other way ?
[For instance saving the connection string, or it's parts within the 'Session' object and creating the connection as required - be it saving the text as is or encrypted and then decrypting it when needed].
Any advice / pointers would be appreciated.
Thanks in advance
Steve
I'm using Visual Studio ASP.NET (with C# code).
I had been developing it in such I way that I was saving the SqlConnection in the 'Session' object (with the object primed with the connection string consisting of the server-name, database-name, etc).
However it was suggested to me by a colleague that this was not a good move and he instead suggested I create the connection as required, creating the connection string in each instance.
My question is this :
- How sensible is it to store a SqlConnection object in the 'Session' object ?
- Should I be managing this practise in some other way ?
[For instance saving the connection string, or it's parts within the 'Session' object and creating the connection as required - be it saving the text as is or encrypted and then decrypting it when needed].
Any advice / pointers would be appreciated.
Thanks in advance
Steve