Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Dec 22 '11 at 19:50

This question came from our site for professional and enthusiast programmers.

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

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.

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.