Problem and Solutions

1

Like

How to pass an array in a QueryString ?


Hi
I am developing a website in asp.net and C#, I need to pass array in QueryString.

Currently I am using Cookies for transferring array from one page to another page.

But problem is that when i open same page in multiple window with different parameter then old page result is replacing with current page.

So that i decided to use QueryString But problem is that i don't know is it supporting in QueryString.

Could someone help me to solve this problem
Posted by: Sam
On 17 Oct 2012 | Views: 4363 | Categories: C#, ASP.NET
Solutions(5)
 On 18 Oct 2012 12:09:50 PM
Passing array in QueryString

pageone.aspx

ArrayList arrParam = new ArrayList();
arrParam.Add("1,2,3,3");
arrParam.Add("2,3,4");
arrParam.Add("56,7,6");

string strParam = String.Join("|", ((string[])arrParam.ToArray(typeof(String))));

Response.Redirect("pagetwo.aspx?param=" + strParam);


pagetwo.aspx

string[] param = Request["param"].ToString().Split('|');
ArrayList arrparam = new ArrayList();
foreach (string str in arrparam)
{
arrparam.Add(str);
}
 On 09 Nov 2012 10:22:39 AM
Cant you use .net session handling to keep it simple
 On 09 Nov 2012 11:02:06 AM
Dear Vall

We can use session but session uses server memory, it causes performance issues when number of concurrent users will increase.

I think QueryString is the Best option, only thing is we need to pass it in encrypted format

Regards
 On 11 Nov 2012 05:18:18 AM
i was going to suggest session but it can cause performance issues as Michael explained above. But if this can be eradicated, this is the better solution.

the default maximum length for query string is 2048. this is configurable in .net 4.0.
i'll advise you take this into account.
you have to ensure that your array string's length doesn't exceed the permissable maximum length
 On 11 Nov 2012 10:59:37 AM
I agree with @Francis about the querystring size limit, you have to ensure that your array string's length doesn't exceed the permissable maximum length
Post your Solutions  

 

Other lins

.Net Techies
Other lins