开发者

Posting form data from an ASP.Net Website to a MVC Web Application

开发者 https://www.devze.com 2023-04-07 01:32 出处:网络
I have two distinct web sites, one an ASP.Net website and the other a ASP.Net MVC web application. I want to be able to post form data (about 15 fields) from the ASP.Net website to the MVC web applica

I have two distinct web sites, one an ASP.Net website and the other a ASP.Net MVC web application. I want to be able to post form data (about 15 fields) from the ASP.Net website to the MVC web application.

Ideally I'd like to be able to create a complex object containing all the form data and post it from the website to the controller action but I'm unsure if this is possible.

开发者_运维百科

What are your thoughts on the best way to do this?


There's really nothing to it.

On your ASP.NET web application, you build your form

<form action="http://your/mvc/app/controller/endpoint" method="POST"> 
   <input type="text" name="property" />
   <!-- Build your complex type properties here. Not sure how complex it is, but you may have to look up custom model binding -->
</form>

When that form is submitted it will post the data to your MVC controller who can pick it up and do something with it. And probably redirect to your ASP.NET application.

0

精彩评论

暂无评论...
验证码 换一张
取 消