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

DaveRandom
  • 87,921
  • 11
  • 154
  • 174
niao
  • 4,972
  • 19
  • 66
  • 114

1 Answers1

1

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..

heisthedon
  • 3,657
  • 3
  • 21
  • 24
  • 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 Mar 17 '10 at 19:46
  • 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 – heisthedon Mar 18 '10 at 00:34