title: False routing in asp.net core mvc
body: <p>I click a button in my webapp and the page goes to the url "<a href="https://localhost:44321/Home/Generate" rel="nofollow noreferrer">https://localhost:44321/Home/Generate</a>". When I click the button a second time the page goes to the url "<a href="https://localhost:44321/Home/Home/Generate" rel="nofollow noreferrer">https://localhost:44321/Home/Home/Generate</a>" and I get an error because the page is not found.</p>
  
  <p>I have a button with the following code:</p>
  
  <pre><code>&lt;form method="post" action="Home/Generate"&gt;
      &lt;input type="submit" value="Generate" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I have a Startup.cs:</p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      app.UseMvcWithDefaultRoute();
  
      app.UseMvc(routes =&gt;
      {
          routes.MapRoute(
              name: "default",
              template: "{controller=Home}/{action=Index}");
      });
  
  }
  </code></pre>
  
  <p>and I also tried to add:</p>
  
  <pre><code>routes.MapRoute(
      name: "generate",
      template: "{controller=Home}/{action=Generate}");
  </code></pre>
  
  <p>In my HomeController I call the method after a click like this:</p>
  
  <pre><code>[HttpPost]
  public IActionResult Generate()
  {
      bool result = false;
      if (result) return RedirectToAction("Window", new { param = order.ID.ToString() });
      else return RedirectToAction("Window", 0);
  }
  
  public IActionResult Window(string param)
  {
      if (param == "NotReady")
      {
          ViewBag.JavaScriptFunction = string.Format("ShowNotReady();");
      }
      else
      {
          ViewBag.JavaScriptFunction = string.Format("ShowError();");
      }
      return View("Index");
  }
  
  public IActionResult Index()
  {
      return View();
  }
  </code></pre>
  
  <p>What I have to do, that "<a href="https://localhost:44321/Home/Generate" rel="nofollow noreferrer">https://localhost:44321/Home/Generate</a>" is the url after every button click, not only after the first click?</p>