I am trying to rewrite a url for a pdf to an aspx page it isn't working. I doesen't see the request in my iis-log either.

    <rule name="PDF" stopProcessing="true">
      <match url="PDF/(.*?)/(\d*)/(.*?.pdf)$" />
      <action type="Rewrite" url="SISPdf.aspx?id={R:2}&amp;fn={R:1}" logRewrittenUrl="true" />

An example:


should be rewritten to:


With all my attempts I get HTTP 500 or HTTP 404.

Is it possible to debug rewrite-rules?


At the old IIS (<= 6) i remember me that i must set the ISAPI-Filter for ASP/ASP.Net on PDF or Image file extension so the IIS know that he must handle this. Is there any equivalent?

  • Have you verified that .pdf is listed in your IIS mime types? Dec 21, 2011 at 15:29
  • no, how i do this?
    – Floyd
    Dec 21, 2011 at 15:40
  • btw: static pdf's would be shipped
    – Floyd
    Dec 21, 2011 at 16:31

2 Answers 2


Try changing

<match url="PDF/(.*?)/(\d*)/(.*?.pdf)$" />


<match url="PDF/(.*)/(\d*)/(.*).pdf$" />

Also, take off "stopProcessing='true'". Since you're doing a rewrite, you would actually like to continue processing.

  • doesn't work -> 404 - File or directory not found
    – Floyd
    Dec 21, 2011 at 15:38
  • I just modified it, give it another shot.
    – Mike Richards
    Dec 21, 2011 at 15:44
  • doesn't work too
    – Floyd
    Dec 21, 2011 at 15:47
  • i also try "PDF/(.*)/(\d*)/(.*)\.pdf$" and "^PDF/(.*)/(\d*)/(.*)\.pdf$"
    – Floyd
    Dec 21, 2011 at 16:45
  • What error are you getting now?
    – Mike Richards
    Dec 21, 2011 at 16:59

To debug the URL Rewrite module, you can use the IIS 7.x "Failed Request Tracing," which, contrary to its name, can be used to trace successful as well as failed requests. This learn.iis.net page illustrates how to configure this and amount of detailed debugging information that is available. You don't need to create a test page as suggested in the blog entry--- just jump to the "Configure Failed Request Tracing" section.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .