简体   繁体   中英

IIS7 jpeg image as application

I want to create an banner counter. For that I've created an very small value counter when image is requested from other IP: http://www.t78.ch/apps/mva/mva.jpg.ashx

It runs on my test server. Please, is there any possibility to get rid of the extension of .ashx to only write the .jpg extension? Can you provide me how to manage this in the IIS manager of Win7?

If I just set the "Handler" in IIS7 to ".jpg" the Firefox browser returns that the image is defective or bad and does only show the textmessage.

Regards Nasenbaer

You can do it with a rewrite rule. You can use Microsoft's URL Rewrite Modele . The rule would look something like:

<rewrite>
     <rules>
         <rule name="Special JPG rewrite" stopProcessing="true">
             <match url="apps/mva\.jpg$" />
             <action type="Rewrite" url="apps/mva.jpg.ashx" />
         </rule>
     </rules>
 </rewrite>

This would go in your web.config file under system.webServer. I didn't test the rule, but it should be close enough to figure out. If you had other special cases like this, then you might be able to broaden the regular expression to match more requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM