0

I am trying to set URL because I am using AJAX get for all the processes. When I login in to the site it must say Home>PortalUser

When i click a menu say (Reseller) it should say Home/PortalUser/Reseller. then when i click a sub menu of reseller say Settings URL should be like this

Home/PortalUser/Reseller/Settings.

From this page i click the menu Reseller againg, then the URL should be like this Home/PortalUser/Reseller

How can I set this. I Am new to MVC , so pardon me if this is a silly question. Thanks in advance

Arjun

2
  • What you mean? did you want to setup a breadcrumb? Commented Dec 28, 2013 at 11:55
  • like a breadcrumb, but instead i need URL of browser to look like it. As i said am using AJAX and so it wont affect browser url. All i need to do is update the url based on pages Commented Dec 28, 2013 at 11:56

1 Answer 1

1

You need to define new route configuration in your Global.asax for this specific controller like this:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.MapRoute(
        "Default",                                              // Route name
        "{controller}/{action}/{id}",                           // URL with parameters
        new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
    );

    routes.MapRoute(
        name: "PortalUserRouter", 
        url: "Home/PortalUser/{controller}/{Action}/{id}", 
        defaults: new { controller = "Reseller", id = RouteParameter.Optional}
    );
}

Assuming your controller is Reseller.

Sign up to request clarification or add additional context in comments.

23 Comments

this will create a breadcrumb rt? what i want is to set the browser URL
ah I see, I'm confused with your questions.
My apologies.. So can you help me out??
Well, i already make an edit 4 hours ago on my post, you can check it out.
hi reptildarat, sorry for the late response. i was out of town. Let me try this & will get back to you
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.