这个问题之所以存在,是因为它确实存在 具有历史意义,但事实并非如此 被认为是一个很好的主题问题 因为是本网站,所以请不要使用 作为证据,你可以问类似的问题 这里的问题。 更多信息:https://stackoverflow.com/faq
总有一些功能在边缘场景中很有用,但正是因为这个原因,大多数人都不知道它们。我要求的是课本上通常没有教过的特性。
你知道的是什么?
这个问题之所以存在,是因为它确实存在 具有历史意义,但事实并非如此 被认为是一个很好的主题问题 因为是本网站,所以请不要使用 作为证据,你可以问类似的问题 这里的问题。 更多信息:https://stackoverflow.com/faq
总有一些功能在边缘场景中很有用,但正是因为这个原因,大多数人都不知道它们。我要求的是课本上通常没有教过的特性。
你知道的是什么?
当前回答
这是最好的一个。把它加到你的网里。配置更快的编译。这是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.
通过在这里:
其他回答
在测试时,您可以将电子邮件发送到计算机上的文件夹,而不是SMTP服务器。把这个放到你的web.config中:
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\" />
</smtp>
</mailSettings>
</system.net>
如果您放置一个名为app_offline.htm的文件 在一个web应用程序目录的根目录,ASP。NET 2.0+将关闭应用程序并停止对该应用程序的任何新传入请求的正常处理,只显示所有新请求的app_offline.htm文件的内容。
这是在将更改重新部署(或回滚)到生产服务器时显示“站点暂时不可用”通知的最快速和最简单的方法。
另外,正如marxidad所指出的,确保文件中至少有512字节的内容,这样IE6才能正确地呈现它。
在网站发布并部署到生产服务器后,如果我们需要对服务器端按钮进行一些更改,则单击事件。我们可以在aspx页面本身中使用new关键字来覆盖现有的click事件。
例子
代码背后方法
Protected void button_click(sender object, e System.EventArgs)
{
Response.Write("Look Ma', I Am code behind code!")
}
覆盖方法:
<script runat="server">
Protected void new button_click(sender object, e System.EventArgs)
{
Response.Write("Look Ma', I am overrided method!")
}
</script
通过这种方式,我们可以轻松地修复生产服务器错误,而无需重新部署。
将位于App_Code文件夹中的类附加到全局应用程序类文件。
ASP。NET 2.0 -全球。asax -代码背后文件。
它也可以在Visual Studio 2008中工作。
Page指令中的MaintainScrollPositionOnPostback属性。它用于在回发时保持aspx页面的滚动位置。