2

I saved a file , which contains % and %20

when i click on a link,which is pointing to this file. By using javascript am doing encodeURI(filePath).

Getting file not found error, but file is available.

Browser Chrome and IE, Server: IIS Server

actual URl : http://<servername>/<Folder>/PDF/!%2-!@crackerunit&%_20151029203000_0.pdf

encodedURl : http://<servername>/<Folder>/PDF/!%252-!@crackerunit&%25_20151029203000_0.pdf

Badrinarayana
  • 165
  • 2
  • 16

1 Answers1

0

Follow these steps:

 1. Original pdf: !%2-!@crackerunit&%_20151029203000_0.pdf
 Use JavaScript encodeURI: encodeURI("!%2-!@crackerunit&%_20151029203000_0") 
 Resulting output: !%252-!@crackerunit&%25_20151029203000_0.pdf
 Complete url: http://<servername>/<Folder>/PDF/!%252-!@crackerunit&%25_20151029203000_0.pdf
 Once this url is accessed, you receive an exception: A potentially
 dangerous Request. Path  
 value was detected from the client (%). Solve this problem by following  
 step2 

 2. web.config changes:
 <system.web>
   <httpRuntime requestPathInvalidCharacters="" 
   />
 </system.web>
Sudipta Kumar Maiti
  • 1,669
  • 1
  • 12
  • 18