Last post Sep 11, 2015 02:28 PM by amitshinde
Sep 09, 2015 05:57 PM|amitshinde|LINK
I have received a piece of code in which there is a session variable in a user control file (.ascx file). I have to use this user control at 2 different places in ASP.NET application.
Problem is if an user opens these 2 pages concurrently and tries to update values on those pages, there will be mixing of values for session variable. Is there any way to address this issue ?
I am open to replace session variables if there is any better alternative. I would like to keep the use of session variables exclusive to the page on which its being used. Please let me know.
Sep 09, 2015 06:09 PM|Nataraj Gandhi Arunachalam|LINK
Even if a user control was not used, the same problem will probably exist if the same session variable was used in different pages and the different pages were opened at the same time concurrently by the same user.
So, if you want something exclusively for the page, then I do not think session variable is a good option. You can try for a different solution, such as maybe using private variable just in cope of that page. Or a static variable in case the data is shared
(but always be very careful while using static variables).
Sep 11, 2015 02:28 PM|amitshinde|LINK
Thanks for the response Nataraj !