0

Our webform (ProcessStudent.aspx) is designed to receive three parameters in the QueryString: Name, Grade, Class. Page_Load retrieves these three parameters and sends it to a method SaveStudent (ie. SaveStudent(name, grade, class);).

I need to process several three-parameter combinations for one page. I basically copied/pasted ProcessStudent.aspx, but I need to modify the way I read the parameters. I can change the URL structure, but everything else needs to stay the same.

So my initial thought was to include these combinations in the URL; for example, each value would be separated by a char and each combination by another char. Something like this, which I would then parse :

ProcessStudent.aspx?Students=Joe|5|Science,Bob|6|Math,Mary|5|English

Would something like this work? Is there a better way?

2 Answers 2

1

Yes it would work. As far as better... You could post a json string, which would be much cleaner. I personally would use a rest service with just JSON(or XML if you like).

Hope this helps.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the comment. Since the webform works with input via the URL, would you have a link that would show me how to post the data without having to make major changes to the webform?
Well this is close to what I had pictured:
1

The thing you'll need to watch out for is that the query string has a length limit in some browsers (https://stackoverflow.com/a/812962/97382) so depending how many you mean by "several" and which browser(s) you're using you could run into those limitations.

You would be better off to POST the data as you do not run into the size limitations.

3 Comments

Thanks for the comment. Since the webform works with input via the URL, would you have a link that would show me how to post the data without having to make major changes to the webform?
I don't have one handy but I'm sure if you google something like "asp.net webform post" you'll find lots of options.
Also the convention is to use POST to create new records as GET is supposed to be idempotent.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.