none
MVC 5 Session Variables to filter data whilst logged in RRS feed

  • Question

  • I'm creating an MVC 5 c# application that needs to filter data from login. In addittion to the username & password I will be also using a dropdown that will restrict data from the entity to a particular value ID, which needs to persist throughout the login session. For example, User logs in & selects a particular location to get all products from that location, which filters the data against the ID for every view whilst logged in for that session.

    Not sure if using session variables is the right way to achieve this, and would much appreciate any suggestions. I am using asp.net 4.7.2 & razor engine.

    • Moved by CoolDadTx Monday, October 7, 2019 1:49 PM ASP.NET related
    Sunday, October 6, 2019 11:25 AM

All replies

  • Hello,

    Best to post this question over in the ASP.NET Forums.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Sunday, October 6, 2019 11:55 AM
  • You would need a action filter.

    https://www.infragistics.com/community/blogs/b/dhananjay_kumar/posts/how-to-create-a-custom-action-filter-in-asp-net-mvc

    As mentioned ASP.NET MVC issues can be discussed at the ASP.NET forums.

    Sunday, October 6, 2019 1:52 PM