Hi
How can I use validation from HomeController with post method. throw new Exception("This ip is not valid !!!",);
<div class="form-group">
<label asp-for="Ip" class="col-md-2 control-label"></label>
<div class="col-md-4">
<input asp-for="Ip" class="form-control" asp-is-disabled="true"
value="@HttpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString()"/>
<span asp-validation-for="Ip" class="text-danger"></span>
</div>
</div>
[HttpPost] public ActionResult Register(Kullanicilar kullanicilar) { if (kullanicilar.IP == "0.0.0.0") { throw new Exception("This ip is not valid !!!",); return View(); } else { if (ModelState.IsValid) { _context.Kullanicilar.Add(kullanicilar); _context.SaveChanges(); ModelState.Clear(); ViewBag.Message = kullanicilar.Adi + " " + kullanicilar.Soyadi + " kaydınız tamamlandı."; } return View(); } }