So, we will first check how we can access the value of TextBoxFor control in asp.net core 8 mvc application using c#.net. 
How to Access Value of TextBoxFor Control in Asp.net Core 8 MVC In C#
First, we will add a model class file for c#.net. This file name we keep as "UserModel". This will be our model file. In this file we will keep two properties as shown below.
namespace Project.Models
{
    public class UserModel
    {
        public string Name { get; set; }
        public string Location { get; set; }
    }
}
What is the Model Class in Asp.Net Core MVC Application?
  A model class file in asp.net core mvc application represents the business logic. Model class file we add in Model folder. In a lay man language the Model class file contain properties which represents the fields structure of controls available on the screen.
First, we will add HttpGet and HttpPost methods in the added controller. Please check the below code.
using Microsoft.AspNetCore.Mvc;
using Project.Models;
using System.Diagnostics;
namespace Project.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }
        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public IActionResult Index(UserModel userModel)
        {
            return View();
        }
    }
}
@model UserModel
@{
    ViewData["Title"] = "Home Page";
}
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { @Id = "formdata", @enctype = "multipart/form-data" }))
{
    <div class="text-center">
        <b>Name:</b>
        @Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
        <br />
        <b>Location:</b>
        @Html.TextBoxFor(m => m.Location, new { @class = "form-control" })
        <br />
        <input type="submit" value="Submit" />
        <br />   
        <br />
        <b>Your Name: </b>@ViewBag.Name  <br />
        <b>Your Location: </b>@ViewBag.Location
    </div>
}
As in the code above I have shown that the controller is having an Index method decorated with HttpPost. 
In the code I have used the model class property to bind the TexttBoxFor control. Binding the ViewModel property will help us to get the added value in control at the controller end.
In the following I have used ViewBag to to store and display the captured value at the controller end. Now we will make some modifications in the our httppost method code assig the user added value and pass it to view.
 [HttpPost]
 public IActionResult Index(UserModel userModel)
 {
     ViewBag.Name = userModel.Name;
     ViewBag.Location = userModel.Location;
     return View();
 }
Now we add value and click on the submit button.
The controller will get the added value n respective model class property.
What is the difference Between TextBox and TextBoxFor in Asp.Net Core MVC?
- In Asp.Net Core MVC or Asp.Net MVC TextBoxFor is a strongly type and on other hand TextBox is a not a strongly type control. At the end of the execution both will generate the Input tag of control type text.
- Here in case of TextBoxFor control the name of control will be the ModelName_Property (Eg: UserModel_Name). On other hand the name of control will be the same name which we provided.
- Here the name of the controls will help up to get the control value at the controller end. We need to pass the name or the model class as parameter in the HttpPost method.
How to Access Value of TextBox Control in Asp.net Core 8 MVC In C#?
To display the textbox control using TextBox in asp.net core mvc application in controller we will add the HttpGet and HttpPost method.
        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public IActionResult Index(string Name, string Location)
        {          
            return View();
        }Now we will create the view and the below code into it.
@{
    ViewData["Title"] = "Home Page";
}
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { @Id = "formdata", @enctype = "multipart/form-data" }))
{
    <div class="text-center">
        <b>Name:</b>
        @Html.TextBox("Name", "", new { @class = "form-control" })
        <br />
        <b>Location:</b>
        @Html.TextBox("Location", "", new { @class = "form-control" })
        <br />
        <input type="submit" value="Submit" />
        <br />
        <br />
        <b>Your Name: </b>@ViewBag.Name  <br />
        <b>Your Location: </b>@ViewBag.Location
    </div>
}
Here I have used ViewBag to display the user entered value.  Now we will make some modification in our controller code to assign the entered value to ViewBag.
        public IActionResult Index(string Name, string Location)
        {
            ViewBag.Name = Name;
            ViewBag.Location = Location;
            return View();
        }







