I have a little problem here. I need to add a trailing slash at the end of each url in the site I'm working on. I defined all the links inside the site to have a trailing slash like so:
<a href="/register/">Register</a>
While this works fine there's still one tiny issue: it's with the generated urls that come from calling RedirectToAction(). For example:
return RedirectToAction("Register", "Users");
Will cause the url to change to /register with no trailing slash. I modified my routing system as so:
routes.MapRoute("register",
"register/",
new {controller = "Users", action = "Register"}
);
Still the required trailing slash doesn't get added automatically!
I looked up this question and this question but these are totally different as I'm not using any url rewriting libraries, i'm just using asp.net mvc routing system.
So what do you say guys?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…