Configure Route MVC page

Asked

Viewed 187 times

1

I have a website and when entering the home page it is redirected to another view.

Thus:

www.exemplo.com redirects to www.exemplo.com/Home/Hotsite

That’s because I have a feature that when entering the view Home/Index www.exemplo.com/xpto, will carry the view Index which is the login screen, customized according to the parameter passed(foo) .

I wonder if it is possible to hide the redirected URL from view Hotsite, so when I come in www.exemplo.com, will display only www.exemplo.com, and not www.exemplo.com/Home/Hotsite.

It is possible to do this without changing the views?

these are the routes I have:

routes.MapRoute(
            name: "Inicial",
            url: "{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
  • What version of Asp.Net MVC are you using?

  • 1

    Has, but, I need to see your route file and also if there is any route configured to site base, could post?

  • The version is Asp.net 4

  • I put the routes I have configured

1 answer

0

Solving with areas

You can use the functionality to create areas *right-click on the project name and select Add / Area *

With this you can create for example admin routes:

  1. site.com/admin/home
  2. site.com/admin/users
  3. site.com/admin/test

MSDN reference

Browser other questions tagged

You are not signed in. Login or sign up in order to post.