Monday 15 July 2013

asp.net - URL Rewrite rule for IIS to replace folder path in everypage -


We have more than 300 pages in our website project From time to time, we have created a new server which is secure.

  • Current implementation for images (aspx, in css)

    / P>

     < Code> http://www.mysite.com/assets/common/image1.jpg    
  • Sometimes specified in webpage and CSS in this way

    / P>

      http://www.static.mysite.com/common/image1.jpg    
  • For more secure pages < / P>

      https://www.static.mysite.com/common/image1.jpg     

    As you all You can see that the images are coming from the ~ / assets folder but now I have ~ / asset with http://static.mysite.com Want to make a rule instead. Code>

    How can I use the rewrite rule in IIS.

    Example:

    ASPX
      & lt; Img Src = "/ property / common / image 1. JPGG" id = "image1" alt = "image" width = "100" height = "100" / & gt; & Lt; Img src = "http://mysite.com/assets/common/image2.jpg" id = "ImageId2" alt = "picture" width = "100" height = "100" />   

    When you want to do the IIS rule, when the code gets above it, it

      & lt; Img src = "http: //static.mysite.com / common / image1.jpg" id = "ImageId1" alt = "image" width = "100" height = "100" /> & Lt; Img src = "http://static.mysite.com/common/image2.jpg" id = "ImageId2" alt = "picture" width = "100" height = "100" />    

    You will need to create an outbound rule in IIS Rule will need:

    1. Precondition should only check HTML files (I use the default HTML)
    2. Select the "Match with content" elements in which you want to check the link
    3. The pattern is ^ (. *) / Property /(.*)] / code>
    4. The action property is {R: 2}. R: 2 In the regular expression above the second () fills again. You can check after clicking on the "Test Pattern" button.

      The simple rule that comes from above is:

       Enter image details here

No comments:

Post a Comment