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.

<rewrite>
  <rules>
    <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" />
    </rule>
  </rules>
</rewrite>

An example:

http://myserver:8089/PDF/ABC/123/DEF_456.pdf

should be rewritten to:

http://myserver:8089/SISPdf.aspx?id=123&fn=ABC

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

Is it possible to debug rewrite-rules?

Edit:

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?

link|improve this question
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
feedback

migrated from stackoverflow.com Dec 22 '11 at 19:50

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

1 Answer

Try changing

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

to

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

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

link|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
show 4 more comments
feedback

Your Answer

 
or
required, but never shown

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