Passing array values in an HTTP request in .NET

后端 未结 3 2032
广开言路
广开言路 2020-12-30 03:17

What\'s the standard way of passing and processing an array in an HTTP request in .NET? I have a solution, but I don\'t know if it\'s the best approach.

Here\'s my s

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 03:33

    If you are using checkboxes or a multi-select list box, then a comma-separated set of values is what you get automatically from html. What you are doing is perfectly fine. If you generate an array in your javascript in some other way, you could generate comma-separated string and assign it to a hidden field, and use split() on the server in the same way. XML is certainly another option, but it seems to complex to me if all you want to do is pass a simple array of numbers or short strings. (Of course, if the string values you need to pass contain commas, this would screw up your simple plan.)

提交回复
热议问题