Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|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
add comment

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

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

2 Answers

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.

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

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.

share|improve this answer
add comment

Your Answer

 
discard

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.