S
S
SamFisher2015-12-23 10:13:32
ASP.NET
SamFisher, 2015-12-23 10:13:32

ASP.NET MVC how to send a POST request from a controller?

Good afternoon!
The page has a form that sends a POST request to the controller. In the controller, we process the received data. And after that, you need to send them, as well as a POST request to an external resource.
Not even just forward, but go to an external resource.
Just making a redirect to www.site.ru/page?parameter1=7 does not work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Kovalsky, 2015-12-23
@dmitryKovalskiy

The solution is a crutch, but without them, nothing immediately comes to mind. Return from your controller a View which will have a form on the third party site. Fill it out and immediately submit the form with the script when the page is ready.
UPD: stackoverflow.com/questions/46582/response-redirec... Here is a solution, but it's not perfect.

S
SamFisher, 2015-12-23
@SamFisher

Yes, you can use a script to send an Ajax request from an existing form, wait for a response and make a redirect. But this is a payment and I don’t want to use scripts.

H
heartdevil, 2015-12-23
@heartdevil

Hello.
Usually they receive data from their form, process it, and then send it somewhere further via HttpWebRequest.
Here are examples:
http://www.asp.net/web-forms/overview/getting-sta...
www.codeproject.com/Articles/42894/Introduction-to...
I didn't quite understand the redirect, but HttpWebRequest there is a property AllowAutoRedirect. Maybe this will help, xs).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question