3
votes

I search and read all the questions i could find here and in google, and I can't seem to find the answer!

The Rout in questions is this:

routes.MapRoute("Admin - Change Password", "Admin/ResetPassword/{UserId}", New With {.controller = "Admin", .action = "ResetPassword", .UserId = ""})

The Url It Generates is: /Admin/UserAdmin

which is the page the url.action is on. No idea if that matters or not.

When I used the route debugger it showed the Url I expect it to generate as matching the URL i typed in my address bar.

True Admin/ResetPassword/{UserId} controller = Admin, action = ResetPassword, userId =

The only other routes it matched were:

True {controller}/{action}/{id} controller = Home, action = Index, id =

True {*catchall} (null)

The {controller}/{action}/{id} route is the last one, so it shouldn't be interfering.

Any Ideas?

EDIT: the code of the helper:

<%Url.Action("ResetPassword", "Admin", new with {.UserId= u.userId}) %>
2
Can you post the (HtmlHelper) method call you're using generate the url?Charlino

2 Answers

7
votes

Don't use Action/ActionLink to generate a URI for a named route. Use RouteLink/RouteUrl, instead. It's faster, and it never fails to find the route you intend. Full explanation here.

0
votes

So I assume the problem is that you aren't getting directed to the view you expected when you run the application?

What version of IIS are you using? If you are using XP / IIS 5.1, did you make sure to add a wildcard mapping? This is a common gotcha with IIS 5.1.

You can refer to the link here.