[SOLVED] Passing array into query string


I need to send array as query parameter, I do it like this

StringBuilder Ids = new StringBuilder();
for (int i = 0; i < array.Count; i++)
    Ids.Append(String.Format("&id[{0}]={1}", i, items[i].ID));
ifrDocuments.Attributes.Add("src", "Download.aspx?arrayCount=" + array.Count + Ids);

After this I have string:


It can contain 100 elements and in this case I’m getting error:

enter image description here

Maybe I can do it in another way? Not by sending it inside query qtring.


There is a limit on URL length on multiple levels (browsers, proxy servers, etc). You can change maxQueryString (*1) but I would not recommend it if you expect real users to use your system.

It looks like downloads.aspx is your page. Put all those ids in temporary storage – (cache or database) and pass the key to this new entity in the request

*1: https://blog.elmah.io/fix-max-url-and-query-string-length-with-web-config-and-iis/

Answered By – st78

Answer Checked By – Robin (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *