Reputation: 33867
This may be a stupid question, but anyway... I have an MVC site and a legacy ASP.net web forms site. I have a controller action on my MVC site that I would like to (programatically) POST to from my web forms site.
I can find lots of information describing RESTful services etc., but I can't seem to find a resource that explains how to do this bit - anybody point me in the right direction?
Upvotes: 0
Views: 1189
Reputation: 609
This post demonstrates how to post data to web server with HttpWebRequest. You just need to compose your own data to be posted, and change the url that the data will be posted to. It's the url of your controller in your case.
Upvotes: 0
Reputation: 26109
In MVC, there is nothing special about the FORM
on the page (unlike WebForms).
Just create a normal HTML FORM
(without runat="server"
). Set the action
to point to your controller action. Set the method
to POST
.
That's it. In your controller action, you can access the FormCollection
directly, or you can attempt to use parameter/model binding.
Upvotes: 1