Using ASP.NET Core 2.2 with razor pages... I have a razor page1 which includes a table with lots of integer Id-values from a database. I have to open another razor page via JavaScript and pass all the Ids from page1 to page2. At the moment I do it like this:
window.location.href = "/myUrl/page2?idList=..."
and pass the list of Ids as a JSON-string. This works well until the URL becomes too long (the string for idList becomes too long).
What I need to know: how can I pass a long list of integer values to a razor page via JavaScript without getting in the limit with the URL?
TIA Heiko
<form method="post" action="/myUrl/page2">, append a hidden input containing the list as value withname="iDList", then submit the form by callingsubmit()on it. The server must process a POST param instead of a GET param, obviously. (but again, this is a bad workaround for what's most likely an xy problem)<form>and use a hidden filed to store the Ids, or you could use jQuery Ajax (Post) method. If you just want to share the Ids on the client sides, you could use cookies to store the Ids.