本文翻译自:Hidden Features of ASP.NET [closed]

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. 这个问题之所以存在,是因为它具有历史意义,但对于本网站而言,它不被认为是一个好的,主题上的问题, 因此请不要将其作为您可以在此处提出类似问题的证据。

More info: https://stackoverflow.com/faq 更多信息: https : //stackoverflow.com/faq


There are always features that would be useful in fringe scenarios, but for that very reason most people don't know them. 总有一些功能在边缘场景中很有用,但正因如此,大多数人都不了解它们。 I am asking for features that are not typically taught by the text books. 我要求的是教科书通常不会教授的功能。

What are the ones that you know? 你知道的是什么?


#1楼

参考:https://stackoom.com/question/EHx/ASP-NET的隐藏功能-关闭


#2楼

Here's the best one. 这是最好的一个。 Add this to your web.config for MUCH faster compilation. 将其添加到您的web.config中,以便更快地进行编译。 This is post 3.5SP1 via this QFE . 这是通过此QFE发布的3.5SP1。

<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. 快速摘要:我们在ASP.NET中引入了一个新的optimizeCompilations开关,可以在某些情况下大大提高编译速度。 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. 此交换机目前可作为3.5SP1的QFE使用,并将成为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. ASP.NET编译系统采用了一种非常保守的方法,这种方法可以消除它在“顶级”文件发生变化时所做的任何先前的工作。 'Top level' files include anything in bin and App_Code, as well as global.asax. “顶级”文件包括bin和App_Code中的任何内容,以及global.asax。 While this works fine for small apps, it becomes nearly unusable for very large apps. 虽然这适用于小型应用程序,但它对于非常大的应用程序几乎无法使用。 Eg 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. 例如,客户遇到了一个案例,在对“bin”程序集进行任何更改后,需要花费10分钟来刷新页面。

To ease the pain, we added an 'optimized' compilation mode which takes a much less conservative approach to recompilation. 为了减轻痛苦,我们添加了一个“优化的”编译模式,它采用了一种不那么保守的重新编译方法。

Via here : 通过这里 :


#3楼

WebMethods. 的WebMethods。

You can using ASP.NET AJAX callbacks to web methods placed in ASPX pages. 您可以将ASP.NET AJAX回调用于放置在ASPX页面中的Web方法。 You can decorate a static method with the [WebMethod()] and [ScriptMethod()] attributes. 您可以使用[WebMethod()]和[ScriptMethod()]属性修饰静态方法。 For example: 例如:

[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public static List<string> GetFruitBeginingWith(string letter)
{List<string> products = new List<string>() { "Apple", "Banana", "Blackberry", "Blueberries", "Orange", "Mango", "Melon", "Peach"};return products.Where(p => p.StartsWith(letter)).ToList();
}

Now, in your ASPX page you can do this: 现在,在ASPX页面中,您可以执行以下操作:

<form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" /><input type="button" value="Get Fruit" onclick="GetFruit('B')" /></div>
</form>

And call your server side method via JavaScript using: 并使用以下命令通过JavaScript调用服务器端方法:

    <script type="text/javascript">function GetFruit(l){PageMethods.GetFruitBeginingWith(l, OnGetFruitComplete);}function OnGetFruitComplete(result){alert("You got fruit: " + result);}
</script>

#4楼

One little known and rarely used feature of ASP.NET is: ASP.NET的一个鲜为人知且很少使用的特性是:

Tag Mapping 标记映射

It's rarely used because there's only a specific situation where you'd need it, but when you need it, it's so handy. 它很少使用,因为只有你需要它的特定情况,但是当你需要它时,它是如此方便。

Some articles about this little know feature: 一些关于这个小知识的文章:

Tag Mapping in ASP.NET ASP.NET中的标记映射
Using Tag Mapping in ASP.NET 2.0 在ASP.NET 2.0中使用标记映射

and from that last article: 从上一篇文章:

Tag mapping allows you to swap compatible controls at compile time on every page in your web application. 标记映射允许您在编译时在Web应用程序的每个页面上交换兼容的控件。 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. 一个有用的示例是,如果您有一个库存ASP.NET控件,例如DropDownList,并且您希望将其替换为从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: 您可以通过修改web.config来实现ASP.NET,而不是编辑每个Web表单并使用您的自定义版本替换内置的DropDownLists:

<pages><tagMapping><clear /><add tagType="System.Web.UI.WebControls.DropDownList"mappedTagType="SmartDropDown"/></tagMapping>
</pages>

#5楼

DefaultButton property in Panels. Panels中的DefaultButton属性。

It sets default button for a particular panel. 它为特定面板设置默认按钮。


#6楼

MaintainScrollPositionOnPostback attribute in Page directive. Page指令中的MaintainScrollPositionOnPostback属性。 It is used to maintain scroll position of aspx page across postbacks. 它用于在回发中维护aspx页面的滚动位置。

ASP.NET的隐藏功能[关闭]相关推荐

  1. 微信隐藏功能系列:微信朋友圈怎么关闭?

    很多微信隐藏功能的神秘面纱揭开之后都让我们很多人都大感惊艳,不知道本期给大家带来的这个时候也能让大家产生同样的感觉,微信朋友圈怎么关闭? 当你不需要再使用到朋友圈,或者想要暂时关闭的时候,这个微信隐藏 ...

  2. 微信隐藏功能系列3:微信关闭朋友圈广告推送

    我们使用微信好多年了,这个工具不仅仅在社交上为我们带来许多好处,工作.消费中也是给我们带来不少方便之处,大家对微信隐藏功能了解多少?本期分享:微信关闭朋友圈广告推送! 虽然微信为我们带来许多方便,但令 ...

  3. 小天才z6官方禁用怎么关闭_我告诉你小天才z6隐藏功能

    小天才z6隐藏功能:1.小天才z6可以翻转,按住顶部两侧按钮,可以打开卡扣,之后可以翻转手表,手表背面配备摄像头,可以拍摄. 2.小天才z6支持AI智能识物和翻译,翻转手表,打开后置摄像头,扫描英语文 ...

  4. 导航上显示某个地点已关闭什么意思_你的手机地图APP只用来导航?这些隐藏功能不用就太可惜了!...

    每个人的手机都会下载一个地图APP,方便出门在外找不到路时导航使用,不过很多人也都只会一些常规操作,比如直接输入地址,然后查找位置或路线. 其实在手机地图APP里,还有很多实用功能,由于位置比较隐蔽, ...

  5. 手机计算机隐藏功能怎么关闭,手机计算机自带的隐藏功能,我也是现在才知道,功能比你想得多...

    原标题:手机计算机自带的隐藏功能,我也是现在才知道,功能比你想得多 手机从1940年被美国贝尔实验室从战地移动电话机发展而来,已经经历了79年的发展历史.手机里的功能也越来越多,从以前的只能打电话到现 ...

  6. 开启Windows7的隐藏功能:虚拟WiFi和SoftAP(即虚拟无线AP)

    开启Windows7的隐藏功能:虚拟WiFi和SoftAP(即虚拟无线AP),就可以让电脑编程无线路由器,实现共享上网,节省网费和路由器购买费. 1.  以管理员什么分运行命令提示符: 快捷键win+ ...

  7. 华为手机怎么隐藏按键图标_华为手机8个隐藏功能,快来看看有没有你不知道的...

    现在使用华为手机的人越来越多,华为手机也凭借自己强大的性能和功能收割了无数花粉,很多人虽然用着华为手机,但是并没有对手机有过多的深入研究,其实华为手机是有很多隐藏功能的,而这些功能往往都是非常实用的, ...

  8. 增大iphone音量技巧_原来苹果手机隐藏功能这么好用!调整这个设置,一键增大外放音量...

    苹果手机是众所周知的流畅,但是很多朋友都说苹果手机只是流畅,实用功能并不多,其实iPhone手机的实用功能特别多,只是很多都隐藏起来,今天笔者就几个iPhone手机的隐藏功能,实用又有趣哦! 手持 i ...

  9. 隐藏esp_仅需一分钟教你看懂汽车内的隐藏功能,哪些功能是你不知道的?

    车内的按键多种多样,而且越高档的车,按键就越多.除了少数国产车,绝大部分车辆的按键标识都是用英文字母表示,从而导致不少车主只能通过查看说明书才知道是什么意思. 今天小编整理了车内各种按键标识,不是很清 ...

最新文章

  1. Python的list中的选取范围
  2. 为什么我的索尼电视显示服务器异常,索尼液晶电视有哪些故障 索尼电视故障代码大全【详解】...
  3. 100转换成二进制 java,一段简单的java代码,十进制转二进制
  4. cpp知识汇总(1) 指针vs引用、static、const
  5. Linux工作笔记-ssh中-X属性的使用(Linux传界面)
  6. [深度学习-原理]GAN(生成对抗网络)的简单介绍
  7. 解决左下角没有显示桌面图标
  8. 现代 CMake 简明教程(一)- CMake 基础
  9. 从Git的下载到使用github详细教程
  10. td.moveRow方法
  11. 2021年安全生产模拟考试(全国特种作业操作证电工作业-高压电工模拟考试题库一)
  12. 时间 java 时间段_Java 如何判断当前时间是否在指定时间段内
  13. 获取iv和encryptedData
  14. python 实时股票行情_python 实时获取股票行情脚本
  15. 计算机主题绘画能画什么,电脑绘画活动方案
  16. 从LSM-Tree、COLA-Tree谈到StackOverflow、OSQA
  17. 人人开源后台项目maven构建(yyds)
  18. 使用Eclips开发java程序
  19. mmsegmentation导出onnx模型的问题
  20. 计算机二级C语言题型分值占比+考试要求+考试内容

热门文章

  1. jQuery第三方插件
  2. 爬虫实战 | 手把手用Python教你采集可视化知乎问题的回答(内附代码)
  3. 使用textCNN进行文本分类的原理
  4. CG中的深度学习 |Siggraph 2017 相关论文总结
  5. 信号完整性分析6——信号的振铃
  6. 二叉树的ZigZag打印-Java
  7. 服务器做系统怎么规划,如何做系统容量规划 | 知行天下
  8. 由中序后序序列求前序序列
  9. 小强升职记梗概_《小强升职记》读书笔记一
  10. ASTER GDEM V02(30m)、ASTER GDEM V03(30m)、TanDEM(90m)三种全球DEM数据的质量对比