1

I have the following routing:

...
when('/sections/:bookID', {
        templateUrl: 'partials/book.html',
        controller: 'bookCtrl'       
    })
...

Where bookID is defined as parameter but it is also encrypted and encoded so the resulting URL looks like:

/sections/9XhNLs0tI%2fmr67rkJtfhaw%3d%3d

The issue is that this routing is not working?

PS: The unencrypted value works just fine. So, I know the routing is working.

The Encoding was made in C# like this:

HttpUtility.UrlEncode(Convert.ToBase64String(encrytedBuffer)); 

Do you know why the routing does not work this value 9XhNLs0tI%2fmr67rkJtfhaw%3d%3d it looks fine to me?

Veco
  • 180
  • 1
  • 6

2 Answers2

2

The problem is it's being decoded to "9XhNLs0tI/mr67rkJtfhaw==." You should be able to solve it by double encoding / decoding.

Chance
  • 11,043
  • 8
  • 61
  • 84
  • are you suggesting that : HttpUtility.UrlEncode(HttpUtility.UrlEncode(value)) will fix the issue? – Dalorzo Jan 08 '14 at 20:54
  • @Dalorzo nevermind, you're right. I don't know why but I read that as you being snarky and copy/pasting his existing Url Encoding. Double URL encoding *should* produce 9XhNLs0tI%252fmr67rkJtfhaw%253d%253d – Chance Jan 08 '14 at 20:58
  • @Dalarzo I'm pretty sure either would work but I could be off. I haven't had much sleep this week so I'm not exactly firing on all cylinders. – Chance Jan 08 '14 at 21:05
1

The issue is related to these characters: "%2f"

There is a post already on this regards:

Angular JS 'route' doesn't match component with %2F (encoded '/')

Community
  • 1
  • 1
Dalorzo
  • 19,834
  • 7
  • 55
  • 102