0

I have angularJS app using ASP MVC WebAPI. I need to get a code for resetting the user password.

My routes look like this

$routeProvider.when("/reset/:token", {
controller: "loginController",
templateUrl: "/app/views/reset-password-confirm.html"
});

This works:http://localhost:32150/#/reset/AQAAANCMnd8BFdERjHoAwE2FCl2BsBAAAA9pA7cuLEnE6SqyFKTJPlewAAAAACAAAAAAAQZgAAAAEAACAAAAA9GudF4k3KPq1IeOc12moCFFCK80GiVLfQ43LoGgDHawAAAAAOgAAAAAIAACAAAACXlb8kgEE5kb2F2Bnqw1iSins5FyeuzlVOEc12BTtM71OXHAAAABWN9RxDvdzSQUTe2NrvYF6OCw2aQh1HiyBYGbQFhvtaJc3AX71EGAHLvsbIpWv9kgcKkrI9mhSmeCdguT9qQTpURIMulrTFg0z3Y0fEtB6FJHNq7P9S2pGRyCoon3sk2BNUfBamE3Pye2ND3qJfteM2BQAAAAJ17NJK5Nn98CSH4Q8uT5Txj8yHpV6xFVJ2e0Q9At2Bv4YV5r5I0kPdVejBA1WJMLvoJ6l0R5p3R2kXsj73M323I3D

but this doesn't: http://localhost:32150/#/reset/AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAA9pA7cuLEnE6SqyFKTJPlewAAAAACAAAAAAAQZgAAAAEAACAAAAA9GudF4k3KPq1IeOc12moCFFCK80GiVLfQ43LoGgDHawAAAAAOgAAAAAIAACAAAACXlb8kgEE5kb%2F%2Bnqw1iSins5FyeuzlVOEc1%2BTtM71OXHAAAABWN9RxDvdzSQUTe2NrvYF6OCw2aQh1HiyBYGbQFhvtaJc3AX71EGAHLvsbIpWv9kgcKkrI9mhSmeCdguT9qQTpURIMulrTFg0z3Y0fEtB6FJHNq7P9S2pGRyCoon3sk%2BNUfBamE3Pye2ND3qJfteM%2BQAAAAJ17NJK5Nn98CSH4Q8uT5Txj8yHpV6xFVJ2e0Q9At%2Bv4YV5r5I0kPdVejBA1WJMLvoJ6l0R5p3R2kXsj73M323I%3D

I noticed that if I remove % the route works but since the token string has characters like / I have to find a way of encoding it. Any way I can encode the string in ASP MVC webAPI so that it works in AngularJS?

  • The question has been answered here:[link](http://stackoverflow.com/questions/16227004/how-to-capture-urls-with-arbitrary-number-of-slashes-in-angular-js) – Anthony Darwesh May 28 '15 at 15:39

2 Answers2

0

It might be a security issue. Try adding relaxedUrlToFileSystemMapping in your web.config. For example:

<system.web>
<httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" />
</system.web>
Padraic
  • 667
  • 3
  • 10
  • I am using asp Web API as the backend but the front end is AngularJS (in a completely different site) so I think the problem is probably with the AngularJS routing. – Anthony Darwesh May 26 '15 at 16:36
0
 $routeProvider.when("/confirm_email/:token*", {
    controller: "signupController",
    templateUrl: "/app/views/confirm-email.html"
});

Adding the * character to the end of the route will make the code work as expected.