« Previous Next »

Thread: Write Rule ... how to catch URL that end in image.png

Last post 11-18-2008 6:04 PM by syska. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 11-14-2008, 9:23 PM

    • syska
    • Not Ranked
    • Joined on 12-04-2006, 11:10 AM
    • Posts 5

    Write Rule ... how to catch URL that end in image.png

     Hi,

    I want to do some rewriting and I have run into some problems ...

    I have the following URL:
    http://domain.tld/graph/dk4/server/1/10|20|81/image.png

    It does not exist but should be rewriten to the following:
    /graph.ashx?sid={R:1}&type={R:2}&name={R:3}id={R:4}

    With this regex:
    ^graph/([0-9A-z]{1,})/([A-z]{1,})/([0-9])/([0-9|]*)/(image\.png)$

    It works if I test it "Test pattern" ... and I have found that the problem is that I'm adding the extention "image.png". The reason for this is that with out the extention it does not work when adding the link to the phpbb forum ... and its probebly the same other places.

    So ... when the regex is running it only runs agains:
    "image.png" to the pattern ...

    So my question is ... how can I solve my problem so I can catch all the info in the path ?

    best regards
    Mikael Syska

  • 11-15-2008, 12:54 AM In reply to

    Re: Write Rule ... how to catch URL that end in image.png

    I would recommend enabling Failed Request Tracing and looking at the entries added by URL Rewrite which will clearly show the actual URL that should be "tested" in the Test Pattern.

     http://learn.iis.net/page.aspx/467/using-failed-request-tracing-to-trace-rewrite-rules/

     

  • 11-15-2008, 9:07 AM In reply to

    • syska
    • Not Ranked
    • Joined on 12-04-2006, 11:10 AM
    • Posts 5

    Re: Write Rule ... how to catch URL that end in image.png

     Hi,

     Thanks for the heads up ... I will look into it and get back.

     It just seems odd that its working when using the last ... .png extension.

     But as you say, there may be other factors doing something odd here.

    // ouT

  • 11-18-2008, 6:04 PM In reply to

    • syska
    • Not Ranked
    • Joined on 12-04-2006, 11:10 AM
    • Posts 5

    Re: Write Rule ... how to catch URL that end in image.png

    Something must be very wrong here ... or well ... dont really know. It turned out like this ...


    Making links with 2 slash "//" will make one of then disapear when its being evaluated ... 

    And looking at my first post ... 

    I will always need the image.png as the last part ... and not always any ID's just before that.

    So ... my solution was to make 2 rules ... one with ID's and one without ID's ... I can't think of any other way to solve my problem.

     

    Thanks for the help about the Tracing .... 

     

    // ouT

Page 1 of 1 (4 items)
Microsoft Communities