简体   繁体   中英

Post a form to standalone aspx page from MVC5 controller

I want to submit a form from MVC controller to ASPX page There are many examples from where you can submit a form from view to controller action but I am unable to find a solution for subject method.

Here is ASPX code

Value1= string.IsNullOrEmpty(Request.Form.Get("Value1")) ? string.Empty : Request.Form.Get("Value1").Trim();

Value2= string.IsNullOrEmpty(Request.Form.Get("Value2")) ? string.Empty : Request.Form.Get("Value2").Trim();

Value3= string.IsNullOrEmpty(Request.Form.Get("Value3")) ? string.Empty : Request.Form.Get("Value3").Trim();

And I have to call aspx page from a controller action using url

You could do that with a WebAPI Controller rather than a standard MVC Controller. Do try this example: Using Web API with ASP.NET Web Forms . You may use AJAX as in here or calling the WebAPI from the Code Behind of the ASP.Net page. Or you may rather bypass using controllers and use the code behind instead? It depends on your requirement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM