+ 1

C# MySQL create sesid

Hi :) My english is still better from day to day :) I make a program where i have to connect with database (i did it), and i know that the best way is using something like session in PHP. I looked for something about this but in C#, and i found HttpContext and it has property "Current". What about this Current, it is always null. I found information about that and it is only in ASP.NET, but i'm not using ASP.NET but WInForms. How can I create this? please help me :)

22nd Dec 2017, 9:23 PM
Kacper Piotrowski
Kacper Piotrowski - avatar
5 Answers
+ 2
I believe that it is better to use specific sql client to connect to db, not the httpclient https://www.codeproject.com/Articles/823854/How-to-connect-SQL-Database-to-your-Csharp-program
22nd Dec 2017, 9:29 PM
Dima Makieiev
Dima Makieiev - avatar
+ 2
I believe that System.web (httpContext is part of it) used to manage connections between user browser to your app, not just http connections, so if there are no user browser sessions will be null. This why I believe it is better to use libraries witch designed to work with db not just some general, If I correct understand that you want to connect to db.
22nd Dec 2017, 10:43 PM
Dima Makieiev
Dima Makieiev - avatar
0
But i'm using this... I want to know how to use Session.
22nd Dec 2017, 10:25 PM
Kacper Piotrowski
Kacper Piotrowski - avatar
0
So?
23rd Dec 2017, 7:29 AM
Kacper Piotrowski
Kacper Piotrowski - avatar
0
I don't understand what do you mean
23rd Dec 2017, 7:30 AM
Kacper Piotrowski
Kacper Piotrowski - avatar