Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
0


in my asp.net core project, the form is being posted 2 times, but I have examined it, there is no form on the html side, or I removed the entity code, it still posts 2 times, what is the reason?


What I have tried:

public class BlogEtiket : SeoBaseEntity
   {

       public string name{ get; set; }


       public int DilSecenekId { get; set; }

       public string? CurrentCode { get; set; }

       [DisplayName("Tasarım")]
       public int DurumId { get; set; }


       public Durum? Durum { get; set; }


       public ICollection<MFTSub>? MFTSubs { get; set; }

       public ICollection<SectionSub>? SectionSubs { get; set; }



   }




public IActionResult save()
        {
            return View();
        }

[HttpPost]
        public IActionResult save(example entity)
        {

            if (ModelState.IsValid)
            {
                _unitOfWork.repository.savechagn(entity);
                TempData["Message"] = _MessageBox.Success;
                return Redirect("list");
            }
            else
            {
                ViewBag.ModelStateErrors = ModelState.Values.SelectMany(v => v.Errors).ToList();
                TempData["Message"] = _MessageBox.Error;
                return View();
            }

        }
Posted
Comments
mtoha 10-May-23 3:29am    
where is html form code?
Is it using ajax post or using Form?
burakkucukekiciler 10-May-23 5:57am    



burakkucukekiciler 10-May-23 10:31am    
using form
mtoha 10-May-23 21:40pm    
You should check the form sent twice or not. on the request. you can use js loader to prevent user click form twice

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900