title: How can I define custom route in HomeController of ASP.NET MVC?
body: <p>I have an issue about defining a custom route in the HomeController of ASP.NET MVC.</p>
  <p>When I submit the form, the route is defined as <code>Home/BlogSearch/?searchKeyword=Lorem</code>. However, I'd like to get this URL <code>/blogs/blogsearch?searchKeyword=text</code>.</p>
  <p>Here is my form html part which is shown below.</p>
  <pre><code>&lt;form action=&quot;/Home/BlogSearch/&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;searchKeyword&quot; id=&quot;searchKeyword&quot;&gt;
      &lt;button type=&quot;submit&quot; id=&quot;searchButton&quot;&gt;&lt;i class=&quot;bi bi-search&quot;&gt;&lt;/i&gt;&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Here is my BlogSearch function which is defined in HomeController.</p>
  <pre><code>public ActionResult BlogSearch(string searchKeyword, int Sayfa = 1)
          {
              
              var searchList = db.Blog.Include(&quot;Kategori&quot;).Where(
                        x =&gt; x.Icerik.Contains(searchKeyword)
                        ).OrderByDescending(x =&gt; x.BlogId).ToPagedList(Sayfa, 5);
  
              return View(searchList);
          }
  </code></pre>
  <p>I wrote this route but it didn't work.</p>
  <pre><code>routes.MapRoute(
     name: &quot;BlogSearch&quot;,
     url: &quot;blogs/blogsearch&quot;,
     defaults: new { controller = &quot;Home&quot;, action = &quot;BlogSearch&quot; }
  );
  </code></pre>
  <p>How can I fix it?</p>