Doubt Session Asp.net

Asked

Viewed 36 times

0

I need to pass a user’s id through a session, because it’s happening to mix users, because it was being recorded in a variable, has some way, to continue going through the variable, without having to change throughout the project, because in every project it is already being caught by the class variable. In case any way to pass the session to variable only ? I tried passing straight from the default, but as it is passing to variable, without any verification, it is still mixing.

  • has some way to continue going through the variable without having to change throughout the project: Welcome to the unplanned side effects of development! Any gambit for this will only feed the monster you are creating. I think that taking a couple of steps back, designing your idea better and organizing the whole project will be a much better investment

  • Really Diego, I got the project already underway, but unfortunately if I have no alternative I will have to change the whole project. Which way you advise me, for something safe even if you have to change throughout the project ?

  • I often see very commonly authentication via Forms. In this tutorial of Marcoratti it shows a step-by-step for this type of authentication which is quite trivial. See if it suits you.

  • In fact the authentication is already done, I just need in a safe way, if you pass the id of the user you are authenticating, to save for example the correct ID in the log, or to check if the user has access to such page. As I explained in the question, do they mix by class variable, in case it would put the session in the same one? It is the best way?

  • So... there is no "silver bullet". Your scenario is that it will tell you what is best. Specifically, you can save your authenticated user data in the session or control it via cookies. Saving in the session can be interesting for you because it may not change so much the treatment you already have with your variable. Google

  • @Diegorafaelsouza Searching, I found this link on the internet https://webmaicon.wordpress.com/2009/01/15/criando-uma-simples-classe-session-em-aspnet-c/ will occur to mix users this way?

  • Yes, this should work smoothly for you. It looks pretty simple to do. Good luck =)

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.