I catch a mail request from a third-party static page (generated by Adobe Muse) and process it using the MVC action.
<form method="post" enctype="multipart/form-data"> <input type="text" name="Name"> ... </form>
Routing for an empty form action:
app.UseMvc(routes => routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}"));
But according to the action, I have a model with any property empty
Act:
[HttpPost] public void Index(EmailModel email) { Debug.WriteLine("Sending email"); }
Model:
public class EmailModel { public string Name { get; set; } public string Email { get; set; } public string Company { get; set; } public string Phone { get; set; } public string Additional { get; set; } }
Request.Form has all the values ββfrom the form, but the model is empty
[0] {[Name, Example]} [1] {[Email, Example@example.com ]} [2] {[Company, Hello]} [3] {[Phone, Hello]} [4] {[Additional, Hello]}
source share