这个问题之所以存在,是因为它确实存在 具有历史意义,但事实并非如此 被认为是一个很好的主题问题 因为是本网站,所以请不要使用 作为证据,你可以问类似的问题 这里的问题。 更多信息:https://stackoverflow.com/faq
总有一些功能在边缘场景中很有用,但正是因为这个原因,大多数人都不知道它们。我要求的是课本上通常没有教过的特性。
你知道的是什么?
这个问题之所以存在,是因为它确实存在 具有历史意义,但事实并非如此 被认为是一个很好的主题问题 因为是本网站,所以请不要使用 作为证据,你可以问类似的问题 这里的问题。 更多信息:https://stackoverflow.com/faq
总有一些功能在边缘场景中很有用,但正是因为这个原因,大多数人都不知道它们。我要求的是课本上通常没有教过的特性。
你知道的是什么?
当前回答
零售模式在机器。配置水平:
<configuration>
<system.web>
<deployment retail="true"/>
</system.web>
</configuration>
覆盖网络。配置设置以强制调试为false,打开自定义错误并禁用跟踪。不再忘记在发布之前更改属性—只需将它们全部配置为开发或测试环境,并更新生产零售设置。
其他回答
EnsureChildControls方法:它检查子控件是否被初始化。如果子控件未初始化,则调用CreateChildControls方法。
这是最好的一个。把它加到你的网里。配置更快的编译。这是3.5SP1后通过这个QFE。
<compilation optimizeCompilations="true">
Quick summary: we are introducing a new optimizeCompilations switch in ASP.NET that can greatly improve the compilation speed in some scenarios. There are some catches, so read on for more details. This switch is currently available as a QFE for 3.5SP1, and will be part of VS 2010. The ASP.NET compilation system takes a very conservative approach which causes it to wipe out any previous work that it has done any time a ‘top level’ file changes. ‘Top level’ files include anything in bin and App_Code, as well as global.asax. While this works fine for small apps, it becomes nearly unusable for very large apps. E.g. a customer was running into a case where it was taking 10 minutes to refresh a page after making any change to a ‘bin’ assembly. To ease the pain, we added an ‘optimized’ compilation mode which takes a much less conservative approach to recompilation.
通过在这里:
ASP的一个鲜为人知和很少使用的特性。网络:
标签的映射
它很少被使用,因为只有在特定的情况下你才会需要它,但当你需要它的时候,它是如此方便。
一些关于这个小功能的文章:
ASP中的标签映射。网 在ASP中使用标签映射。NET 2.0
从上一篇文章来看:
Tag mapping allows you to swap compatible controls at compile time on every page in your web application. A useful example is if you have a stock ASP.NET control, such as a DropDownList, and you want to replace it with a customized control that is derived from DropDownList. This could be a control that has been customized to provide more optimized caching of lookup data. Instead of editing every web form and replacing the built in DropDownLists with your custom version, you can have ASP.NET in effect do it for you by modifying web.config:
<pages>
<tagMapping>
<clear />
<add tagType="System.Web.UI.WebControls.DropDownList"
mappedTagType="SmartDropDown"/>
</tagMapping>
</pages>
在开始一个长时间运行的任务之前,检查客户端是否仍然连接:
if (this.Response.IsClientConnected)
{
// long-running task
}
这似乎是一个巨大而模糊的问题…… 但我将在这里介绍Reflection,因为它允许我做一些非常强大的事情,如可插拔的DALs等。