title: Asp.net view not call controller method
body: <p>I have view Home</p>
  <p>Here is code of it</p>
  <pre><code>   @{
      ViewData[&quot;Title&quot;] = &quot;Home Page&quot;;
  }
  
  &lt;div class=&quot;text-center&quot;&gt;
      &lt;h1 class=&quot;display-4&quot;&gt;Welcome&lt;/h1&gt;
  
  &lt;/div&gt;
  
  
  &lt;div style=&quot;width: 100%; margin-top: 60px;&quot;&gt;
      &lt;div style=&quot;width: 65%; margin-left: auto; margin-right: auto;&quot;&gt;
          &lt;form id=&quot;form&quot; style=&quot;text-align: center;&quot; asp-action=&quot;ShortenUrl&quot; method=&quot;post&quot;&gt;
              &lt;input
                  type=&quot;text&quot;
                  placeholder=&quot;Enter Url ...&quot;
                  style=&quot;width: 100%; border-radius: 5px; height: 45px;&quot;
                  name=&quot;longUrl&quot;/&gt;
  
              &lt;button
                  style=&quot;background-color: darkgreen; color: white; padding: 10px; margin-top: 25px; border-radius: 8px;&quot;
                  type=&quot;submit&quot;&gt;
                  Shorten Url
              &lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Here is my controller</p>
  <pre><code>public class HomeController : Controller
  {
      private readonly IShortLinkAppService _shortLinkAppService;
  
      public HomeController(IShortLinkAppService shortLinkAppService)
      {
          _shortLinkAppService = shortLinkAppService;
      }
  
      public IActionResult Index()
      {
          return View();
      }
  
      [HttpGet]
      public async Task&lt;IActionResult&gt; Index(string input)
      {
          var shortLink = await _shortLinkAppService.Redirect(input);
  
          if (shortLink == null)
          {
              return View();
          }
  
          return Redirect(shortLink.OriginalUrl);
      }
  
  
      [HttpPost]
      public async Task&lt;IActionResult&gt; ShortenUrl(string longUrl)
      {
          var shortLink = await _shortLinkAppService.GenerateShortUrl(longUrl);
  
          return View(shortLink);
      }
  }
  </code></pre>
  <p>When I click button submit, nothing happens, breakpoint at  <code>var shortLink = await _shortLinkAppService.GenerateShortUrl(longUrl);</code> not hitting</p>
  <p>Here is startup config</p>
  <pre><code> public class Startup
  {
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
              options.UseSqlServer(
                  Configuration.GetConnectionString(&quot;DefaultConnection&quot;),
                  b =&gt; b.MigrationsAssembly(&quot;UrlShortenerApi.EntityFrameworkCore&quot;)));
  
  
          //Mapper
          Mapper.Initialize(cfg =&gt; cfg.AddProfile&lt;MappingsProfile&gt;());
          services.AddAutoMapper(typeof(Startup));
  
  
          services.Scan(scan =&gt;
              scan.FromAssemblyOf&lt;IShortLinkAppService&gt;()
                  .AddClasses()
                  .AsMatchingInterface());
  
          services.AddControllersWithViews();
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseExceptionHandler(&quot;/Home/Error&quot;);
              // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
          app.UseStaticFiles();
  
          app.UseRouting();
  
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapControllerRoute(
                  name: &quot;default&quot;,
                  pattern: &quot;{controller=Home}/{action=Index}/{id?}&quot;);
          });
      }
  }
  </code></pre>
  <p>How I ca fix this issue?</p>