views:

222

answers:

1

Greetings, I have a problem with link in mvc application. When I run it via Visual Studio it's ok. The link then is as follows: http://localhost:2566/ActivateClient/Activate/6543e2d6-707d-44ae-94eb-a75d27ea0d07

when I run it via IIS7 the link is as follows: http://localhost/ActivationService/ActivateClient/Activate/6543e2d6-707d-44ae-94eb-a75d27ea0d07

The default route is as follows:

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

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

    }

I assume I have to change this MapRoute, am I right? How to change it? ActivationService is my virtualDirectory in IIS. Can someone help me with this please? I also tried to maproute as follows:

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

but also without success

A: 

Did you add the new one or replace the existing one?

If you added, you need to position it before the existing one.

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

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

The rules take precedence..

Hery
no, it does not work either, I added the new maprout but it doesn't work. PLease note that I changed the route name
niao
perhaps you can try to use this tool as described in this blog post..http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx
Hery