Is it possible to use foreach
in cshtml file, and use the Session variable?
I want to do something like this:
@foreach (var item in Session["Cart"])
Is it possible?
if(Session["Cart"] != null)
{
foreach (var item in (Session["Cart"] as List<[type]>))
{
//do whatever you need to do
}
}
So the answer is yes
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments