Click here to Skip to main content
11,707,470 members (76,741 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET MVC4
I have an application with several controllers and views. As a user navigates through various vies and controller i need to record the navigation history for back tracking purpose. for this purpose i have decided to use a stack for pushing and popping the navigation history as i move from controller to controller. the problem is after trying a lot of stuff like

static class with static properties,
HttpContext.Applicaion property,
HttpContext.Cache property,
and also theHttpContext.Current.Session
but each time i move from controller to controller these properties are nullified and a new instance is created in each case.(for going from controller to controller I am using RedirectToAction() method)

What i need is an stack that is available throughout the application and i can use it from different controllers to get or set the navigation info.
Posted 4-Jan-13 1:07am
Zoltán Zörgő at 6-Jan-13 6:10am
Any progress?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is what session state is made for. The HttpContext.Current.Session is null only if session handling is disabled, or when accessed from constructor.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 195
1 Mika Wendelius 190
2 OriginalGriff 156
3 Sergey Alexandrovich Kryukov 145
4 chainerlt 110
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,806
4 Mika Wendelius 3,706

Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100