I'm trying to validate an oncoming request, in the OnInitialise action of my reactive web page. However, the request has a long string, which is a token. Unfortunately this is the only way the upstream system can send the data. 


I understand the limitations with the IIS server, not being able to handle more than a certain length of characters and hence it throws a 404 error. I'm just wondering if anyone has a suggestion on how we might be able to handle it?


PS. There is no way to change the source system. 

Hi Tanveer,

Recently I read a post, similar (almost) to the same concern you mentioned and the solution was to shorten the URL using https://tinyurl.com/

I never personally used it, but you can give it a try.


Hope this help!


Regards,

Benjith Sam

Thank you for that quick response. I think, I have a requirement to read the token, so I am not sure how shortening it would help. 


Also, because these are tokens, you would not want to use a 3rd party service to store/create links on your behalf. 

Hi Tanveer,

Is not a good practice to have a token with this long in a request url... you should to review this approach. 

Even so, if this is a "must have" in your scenario, it is possible to change change the maxQueryString setting https://blog.elmah.io/fix-max-url-and-query-string-length-with-web-config-and-iis/

Another option is pass the token in a post request, sending it in the body intead of the URL. 

Here are some good practices you should consider:

  1. Try to keep the query sting length below 512 characters.
  2. Pass bare minimum data through query string.
  3. Never forget that the query string is visible to everyone using the web application. So avoid sensitive data in the query string (username, Password, date of birth, email address, name, etc..).
  4. Try to use server-side session variables instead of passing data in query string.
  5. Always use URL encoding.
  6. Try to use encrypted data in the query string.