这个问题之所以存在,是因为它确实存在 具有历史意义,但事实并非如此 被认为是一个很好的主题问题 因为是本网站,所以请不要使用 作为证据,你可以问类似的问题 这里的问题。 更多信息:https://stackoverflow.com/faq


总有一些功能在边缘场景中很有用,但正是因为这个原因,大多数人都不知道它们。我要求的是课本上通常没有教过的特性。

你知道的是什么?


当前回答

HttpModules。建筑非常优雅。也许不是一个隐藏的功能,但仍然很酷。

其他回答

HttpContext。IsCustomErrorEnabled是一个很酷的特性。我不止一次发现它很有用。这里有一篇关于它的短文。

你可以使用:

 Request.Params[Control.UniqueId] 

在viewstate初始化之前获取控件的值。文本等将在此时为空)。

这对于Init中的代码很有用。

你可以使用UniqueID属性找到任何控件:

Label label = (Label)Page.FindControl("UserControl1$Label1");

这是最好的一个。把它加到你的网里。配置更快的编译。这是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.

通过在这里:

面板中的DefaultButton属性。

它为特定面板设置默认按钮。