如何将.htaccess文件添加到我的Visual Studio解决方案 [英] How to add .htaccess file to my Visual Studio solutions

查看:78
本文介绍了如何将.htaccess文件添加到我的Visual Studio解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要添加 Expires 标头-在谷歌搜索时,我从此链接。但是该文件位于何处?是否可以将其添加到我的Visual Studio解决方案中?

My need is to Add Expires headers - while Googling I got the solution from this link. But where this file is located? Is it possible add it to my Visual Studio solution? Is it necessary to refer such file in master page?

推荐答案

如果要使用以下方法在IIS中为静态内容设置Expires标头,是否有必要在母版页中引用该文件?您需要在web.config中执行ASP.NET。我曾在此处

If you want to set an Expires header for static content in IIS with ASP.NET you need to do it in the web.config. I blogged about this a while back here.

但这是将默认7天有效期添加到以下地址的代码:< system.webServer> 节点

But here is the code to add a default 7 day expiration to the <system.webServer> node of your web.config.

<staticContent>
 <clientCache cacheControlMaxAge="7.00:00:00" cacheControlMode="UseMaxAge" />
</staticContent>

这篇关于如何将.htaccess文件添加到我的Visual Studio解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆