1

When I click on the anchor tag and set a breakpoint on the Controller action below, the breakpoint hit 2 times consecutively why is this 2nd call trigger?

Here is my anchor tag code:

<a asp-area="" asp-controller="Trip" asp-action="Add" asp-route-id="Page1" style="text-decoration:none; font-weight:bold;">Add Trip</a>

Controller code:

public IActionResult Add(string id = "Page1")
{
   return View(id);
}

View code:

@{
    ViewData["Title"] = "Add Trip - Page 1";
}


<h1>Page 1</h1>
8
  • Do you click or double-click? Commented Oct 6, 2023 at 22:57
  • No, i don't do that Commented Oct 7, 2023 at 5:14
  • What is the value of Request.Method during the first and second call? Commented Oct 7, 2023 at 9:22
  • i am getting "GET" in Request.Method value in both calls Commented Oct 7, 2023 at 10:10
  • Both times? Then please post the complete View. This is not the actual view code you use. You have some html, css or javascript in your view which causes the second request. See minimal reproducible example Commented Oct 7, 2023 at 10:12

1 Answer 1

0

This link solved my problem. AdBlocker was the reason of same call hit twice. ASP.NET MVC Action is Called Twice

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.