ASP.NET-MVC – ASP.NET MVC errors generated by URL.Action!

I searched and read all the questions I found here and Google, and I can’t seem to find the answer!

Rout’s problem is like this:

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

The Url it generates is:
/Admin/UserAdmin

This is the page where url.action is located. I don’t know if this is important.

When I use the routing debugger, it shows the Url I want it to generate the URL I entered in the address bar Match.

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

The only other route it matches is:

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

True{* catchall}(null)

{controller} / {action} The /{id} route is the last route, so it shouldn’t interfere.

Any ideas?

Edit: Helper’s code:

<%Url.Action("ResetPassword", "Admin", new with {.UserId= u. userId}) %>

Do not use Action / ActionLink to generate URIs for named routes. Please use RouteLink instead /RouteUrl. It is faster and it will never find the route you want. Full explanation here.

I searched and read all the questions I found here and Google, and I seem to Can’t find the answer!

Rout’s problem is like this:

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

The Url it generates is:
/Admin/UserAdmin

This is the page where url.action is located. I don’t know if this is important.

When I use the routing debugger, it shows the Url I want it to generate the URL I entered in the address bar Match.

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

The only other route it matches is:

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

True{* catchall}(null)

{controller} / {action} The /{id} route is the last route, so it shouldn’t interfere.

Any ideas?

Edit: Helper’s code:

<%Url.Action("ResetPassword", "Admin", new with {.UserId= u. userId}) %>

Don’t use Action/ActionLink to generate URIs for named routes. Please use RouteLink/RouteUrl instead. It is faster and it will never be found The route you want. Full explanation here.

Leave a Comment

Your email address will not be published.