0

We are now starting an asp.net core project. In our old application we used a lot of sessions to store values throughout application. However, we had some issues in using sessions.

My application is like group -> department -> project. If a user select a group we want to store groupId(this is used in navigation or data entry). The same in department and project. So we want to a user carry groupid, departmentnumber, projectid. They can be updated.

for e.g. We have bottom navigation have current group, current department, current project. So user can easily click navigation link and go to specific group or department by groupid or departmentnumber which is stored in application.

Is there any approach that can do the work like session?

thank you in advance.

1 Answer 1

2

Have you considered just using the query string to embed your global variables? Following your sample, it could be something like: /groups/:groupId/departments/:departmentId....

Then by specifying theses parameters within your controller ASP.NET routes, you can use them in each action:

[Route("groups/{groupId:guid}/departments/{departmentId:guid}")]
public class DepartmentController : Controller
{
    public ActionResult Index(Guid groupId, Guid departmentId)
    {
    }
}

Same idea or the others controllers.
It is a very simple and stateless solution adressing many cases ;)

Sign up to request clarification or add additional context in comments.

1 Comment

This a great idea. I will use your idea without any doubt. Thank you for your brilliant idea!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.