0

I want to set my homepage like this /#projects asp.net mvc. on route config file i tried some options but didnt manage to solve it yet

 public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",

            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}
parik
  • 2,313
  • 12
  • 39
  • 67

1 Answers1

0

I want to set my homepage like this /#projects asp.net mvc.

You can't.

Most browsers do not pass anything after the # (fragments are what they are called) to the server, so there is no reliable way for MVC routing (or any other server-side web technology) to read them.

You can generate URLs on the server with fragments but since it is not possible for MVC to read them, there are limited uses for using fragments in MVC.

You can use fragments in client-side routing (using a JavaScript framework of some sort), but not in server-side routing.

NightOwl888
  • 55,572
  • 24
  • 139
  • 212