aspnet mvc not arrivable request form data

Viewed 24

I am building a website in ASPNET MVC architecture. When posting the data on the html form, it gives an error while sending the data to the background in the controller part.

<form ..... >
    <div class="form-group" style="width:50%">
         <input type="text" name="data1" class="form-control" value="" style="background:lightgray" placeholder="example write.." id="data1" required>
         <input type="text" name="data2" class="form-control" value="" id="data2">
         <input type="text" name="data3" class="form-control" value="" id="data3">
    </div>
</form>

Don't get hung up on the names, I've changed them to share on stackoverflow.

It happens when I change the id and name fields in the html form, but this will lead to having to change more than one field in several places.

string data1 = Request.Form["data1"].ToString();
string data2 = Request.Form["data2"].ToString();
string data3 = Request.Form["data3"].ToString().ToUpper();
string data4 = Request.Form["data4"].ToString();
string data5 = Request.Form["data5"].ToString();
string data6 = Request.Form["data6"].ToString();

Has anyone come across such a silly problem?

Error text: System.NullReferenceException: Object reference not set to an instance of an object. at

I'm watching with F10, data comes in another request form

enter image description here

Try-catch does not come in another field

enter image description here

0 Answers
Related