什么℃之间的差;%#%GT;和<%=%&GT ;? [英] What's the difference between <%# %> and <%= %>?

查看:151
本文介绍了什么℃之间的差;%#%GT;和<%=%&GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原谅我的无知ASP,但有什么区别呢?

Pardon my ASP ignorance, but what's the difference?

推荐答案

这些都是有点非正式地称为蜂螫。有4种类型:

These are somewhat informally referred to as "bee stings". There are 4 types:

<%#%> 在数据绑定阶段被调用

<%# %> is invoked during the DataBinding phase.

&LT;%=%&GT; 用于获取从code值的UI层。意味着与ASP应用程序向后兼容。如果在.NET中无法使用。

<%= %> is used to get values from code to the UI layer. Meant for backward compatibility with ASP applications. Shouldn't use in .NET.

&LT;%@%&GT; 重presents的指令并允许行为,以在不诉诸code设置。

<%@ %> represents directives and allow behaviors to be set without resorting to code.

&LT;%:%&GT; (在ASP.NET 4中引入)是一样的%= ,但与HtmlEncoding输出的附加功能。其目的是为这是默认的使用量(超过%= )来帮助盾反脚本注入攻击。

<%: %> (introduced in ASP.NET 4) is the same as %=, but with the added functionality of HtmlEncoding the output. The intention is for this to be the default usage (over %=) to help shield against script injection attacks.

指令指定的设置是   使用的页和用户控制   当编译器编译器进程   ASP.NET Web窗体页(.aspx文件)   和用户控件(.ascx)文件。

Directives specify settings that are used by the page and user-control compilers when the compilers process ASP.NET Web Forms pages (.aspx files) and user control (.ascx) files.

ASP.NET对待任何指令块   (小于%@%>)不包含的   明确指示名字作为@页   指令(一个页面)或作为@   控制指令(用于用户   控制)。

ASP.NET treats any directive block (<%@ %>) that does not contain an explicit directive name as an @ Page directive (for a page) or as an @ Control directive (for a user control).

@Esteban - 增加了一个MSDN链接指令。如果您需要...更多的解释,请让我知道。

@Esteban - Added a msdn link to directives. If you need...more explanation, please let me know.

这篇关于什么℃之间的差;%#%GT;和&lt;%=%&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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