0

I have created an ASP.NET Core application and have a checkout page that needs to post the HTML form to a PHP file.

The problem is that model binding will post back to the Controller - Action that served the page. Is there a way to post an HTML form to a PHP file, for processing, from ASP.NET Core page?

The Form looks like this:

<form action="processor.php" method="post">
</form>

Serviced by: Controller: Store Action: Checkout

As you may know, the model binder will post back to the Store Controller but will throw an exception as it expects to find an Action named processor.php which does not exist.

Is there a workaround to this?

I want to process the posted data in the PHP file.

11
  • I think you can create a custom class that inherits the Controller (see : learn.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/…). Then modify so the input is the text output from the PHP instead of the HTML that is returned in the response. Commented Feb 27, 2021 at 22:10
  • @jdweng: Can you show by a code example? You seem to suggest that input is coming from PHP and form in submitted to the model action. Commented Feb 28, 2021 at 5:05
  • See following : learn.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/… Commented Feb 28, 2021 at 8:38
  • @jdweng: "Creating an Action (C#)" is the title of the article. It is not relevant to my issue. I do not want to create Controller Actions. I want to post to a PHP file not send back to the NET CORE backend Commented Feb 28, 2021 at 9:54
  • You want to parse a response. The two main way of doing this is to either use a controller with an Action or parse the HTML with a library like the HTML Utility Pack. Commented Feb 28, 2021 at 10:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.