Nel

Nel

  • NA
  • 716
  • 1.1m

How to dynamically change the names of the Sessions

Jun 2 2014 2:03 PM

 Hi,

I use Session for passing a string from one web form to another. But I want the Session name to change dynamically and I don't know how to do it.

For example, I want to have a loop where I tried like this

for (var u=7;u<=20;u++)
{
var lineString = '<%= String.Join(",",(Session["'u'"] as List<String>).ToArray()) %>';

....
}

So Session should change to Session["7"], Session["8"],....Session["20"]

Can anybody help me please how to achieve this?
Thanks


Answers (3)