C# Image HttpHandler:在处理程序中禁用 cookie (YSlow / Google PageSpeed)

发布于 2024-08-29 05:17:23 字数 358 浏览 2 评论 0原文

我有一个 HttpHandler 用于调整图像大小、圆角、反射等。我工作正常。我遇到的问题是,一些数据存储在 cookie 中,并且当显示图像时,cookie 会发送到图像。有什么方法可以在 web.config 中全局禁用此功能(无 cookie 请求),甚至在 HttpHandler 本身中禁用此功能?

示例页面: http://test.roob.dk/dk/product /ray-ban-rb3359-polarized-16/

提前致谢 CP // 丹麦

I have a HttpHandler for resizing images, round corners, reflection etc etc. This i working OK. The problem i have is, that some data is stored in cookies, and the cookies are send to images, when they are shown. Is there any way to disable this globally (cookie-free requests) in web.config, or even in the HttpHandler itself?

Example page:
http://test.roob.dk/dk/product/ray-ban-rb3359-polarized-16/

Thanks in advance
CP // Denmark

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情泪▽动烟 2024-09-05 05:17:23

最好的方法是从另一个子域提供图像,例如static.yourdomain.dk。这是因为浏览器会将 cookie 与任何请求一起发送到已发出它们的域 - 因此,当确实不需要它们时,它们将包含在对图像处理程序的任何请求中。当然,您还应该确保您的图像处理程序本身没有设置任何cookie。

有些甚至有多个静态域,例如 static0、1、2、3。这是因为许多浏览器默认情况下只会同时向同一个域发出一两个请求,并等待它们完成,然后再开始下一个请求。要求。通过拥有多个域,您可以允许浏览器并行检索更多资源。这是一篇关于这一点的文章: http://yuiblog .com/blog/2007/04/11/performance-research-part-4/

The best way is to serve the images from another subdomain, for instance static.yourdomain.dk. This is because the browser will send the cookies with any request to the domain, that have issued them - so they will be included for any request to your images handler, when they really are not needed. Of course, you should also ensure that your image handler itself does not set any cookies.

Some even have sevaral static domains, like static0, 1, 2, 3. This is because many browsers by default will only issue one or two requests to the same domain at the same time, and wait for them to complete, before starting the next request. By having multiple domains, you allow the browser to retrieve more ressources in parallel. Here is an article about just that: http://yuiblog.com/blog/2007/04/11/performance-research-part-4/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文