-1

I'm creating an ASP.NET MVC application for students which will learn languages. So, a student logs in and continues learning from the activity where the student stopped the last time. During the learning, after every page, I have to collect the points, count the correct and wrong answers and show the current result on every page. So I need a few parameters during the whole session, like:

  • CurrentActivityId
  • CurrentPageId
  • WrongAnswersCount
  • CorrectAnswersCount
  • CurrentResult

When the user clicks on a correct answer, I should call a function and increase the CorrectAnswersCount, for the wrong answers the same.

What is the best way to store those parameters? I already stored user data in claims, but I don't know if storing these learning parameters in claims is good to use? Can I store them somehow all together in one place, like in one class and save it into the session or is that a bad idea?

Thanks for the help!

EDIT

I know how to use Session and Claims. But my question is for an advice if there are some better methods or if there are some reasons I should not use just the Session.

user5618385
  • 77
  • 1
  • 12
  • [Session](https://msdn.microsoft.com/en-us/library/ms178581.aspx) – Liam Mar 24 '17 at 10:40
  • 2
    Possible duplicate of [how to use session variable in asp using c#](http://stackoverflow.com/questions/5282677/how-to-use-session-variable-in-asp-using-c-sharp) – Liam Mar 24 '17 at 10:41

1 Answers1

1

just create a singleton class with properties that you need and initialize it at the application start then you can access the values from anywhere in the app just add the model reference thats the correct way to do

https://msdn.microsoft.com/en-us/library/ff650849.aspx

RAHUL S R
  • 1,569
  • 1
  • 11
  • 20