Change default URL in address bar in ASP.Net MVC

on Nov 07, 2021 11:01 PM

Hello everyone I have faced a issue I'm login then redirect my page localhost:333333/PubSearch/Search it's working fine but I have face a issue User enter localhost:333333

this in address bar my Index page open I want to hit this url localhost:333333 in address bar localhost:333333/PubSearch/Search this page open.

I have change in startup.cs file but not working .Please help me

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Nov 08, 2021 03:45 AM
on Feb 17, 2022 09:40 AM

You need to register the route in RegisterRoute method in following way.

    "Default",                                              // Route name
    "{controller}/{action}/{id}",                           // URL with parameters
    new { controller = "Home", action = "Index", id = "" }  // Parameter defaults