%2b causing IIS Hosted Angular returning 404

Viewed 104

I have a function that return an url that contains a token and a email back to user's email.

When user click the link it will redirect to my angular application.

However, if the url got encoded by HttpUtility.UrlEncode the the symbol (+) will be turned into %2b.

This is causing problem on my EC2 IIS hosted angular. but it was running fine at local machine.

My API (.Net3.0):

string encode_email = HttpUtility.UrlEncode(model.Email);
var encode_token = HttpUtility.UrlEncode(token);

var confirmationLink = WebsiteUrl + "confirm-email/" + encode_token + 
 "/" + encode_email;

My Angular Route

 {
   path:"confirm-email/:token/:email",
   component:ConfirmEmailComponent
 },

After many tests, I am 100% sure it is the %2b causing the url not working.

here is an example link to my webapp

[removed link]

if you remove %2b and use something else, it works perfectly.

Please help. I am not sure what to do here.

1 Answers

Found the answer,

In your web.config file you have to set DoubleEscaping as true.

<security>
  <requestFiltering allowDoubleEscaping="True" />
</security>
Related