ASPX That Returns An Image - Output Cache-able?

前端 未结 3 1328
再見小時候
再見小時候 2021-02-09 18:57

Greetings!

I\'ve created an APSX web form that returns a remote image based on some supplied parameters. It can be used like this:



        
相关标签:
3条回答
  • 2021-02-09 19:05

    Your problem could be a bug in IE - it can't cache if the Vary:* HTTP response header is used, but IIS returns it by default because it's in the HTTP 1.1 spec.

    Try adding the following to your web.config:

    <system.web> 
        <caching>
            <outputCache omitVaryStar="true" />
        </caching>
    </system.web> 
    
    0 讨论(0)
  • 2021-02-09 19:13

    Use an ASHX generic handler and use the HttpRuntimeCache (Cache object) to do the job as Codebrain said. It will be faster and WAY more flexible.

    0 讨论(0)
  • 2021-02-09 19:27

    Try dropping the Response.End() as this will terminate the thread prematurely and prevent output caching from taking place.

    See: http://bytes.com/groups/net-asp/323363-cache-varybyparam-doesnt-work

    You may wish to consider using an ASHX handler and using your own caching method.

    0 讨论(0)
提交回复
热议问题