C
C#2y ago
Messiah

❔ Razor pages redirect

How do you make a form redirect to a page, and pass a value to it? My entire application is routed as such: "www.site.com/thepage/thequery". How do I get data from the form and pass to the page it, with the query? I can't get it to work without with the url formatted like that
6 Replies
Angius
Angius2y ago
POST request from a given page goes back to the same page and triggers the OnPost/OnPostAsync method That's how forms are sent
Messiah
MessiahOP2y ago
I managed to redirect, but I couldn't pass data along with it whatever I tried, always passes like site.com/thepage?thequery=value
Angius
Angius2y ago
How are you redirecting it?
Messiah
MessiahOP2y ago
string url = "/JsonView/" + Request.Query["qurl"];
return Redirect("JsonView");
string url = "/JsonView/" + Request.Query["qurl"];
return Redirect("JsonView");
Angius
Angius2y ago
Use RedirectToPage() instead
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?