前端群-362632903、java群-513239897、.net群-317243636
jquery
jquery插件
jquery教程
jquery下载
css3
html5
jquery特效
jquery手册
热门关键字:
jquery
>
jquery教程
>
html5
> ASP.NET 中的 HTML 编码和 URL 编码
ASP.NET 中的 HTML 编码和 URL 编码
436
作者:
管理员
发布时间:
2020/3/31 18:08:28
评论数:
0
转载请自觉注明原文:
http://www.jq-school.com/Show.aspx?id=1152
导 读:server.htmlencode 和 server.urlencode 是asp中很常用的函数,在asp.net中也有类似的函数:htmlencode 和 urlencode (注意大小写)以下用实例来进行介绍。
server.htmlencode and server.urlencode are very common functions used by asp developers. well, as you may have guessed, these two functions have asp.net counterparts. htmlencode and urlencode (notice case) are part of the system.web.httputility namespace.
here is the demo
urlencode.asp?test=1&test1=2
urlencode.asp%3ftest%3d1%26test1%3d2
this is a test & hopefully it works!
<h1>this is a test & hopefully it works!</h1>
**********************************
here is the code:
**********************************
<%@ page language="vb" %>
<%@ import namespace="system.web.httputility" %>
<html>
<head>
<title>htmlencode and urlencode the asp.net way</title>
<script language="vb" runat="server">
sub page_load(sender as object, e as eventargs)
assign our test url to a variable, assign the variable to our
label control
dim strurltext as string = "urlencode.asp?test=1&test1=2"
strurl.text = strurltext
encode the test url, assign it to a variable, assign the
variable to our label control
dim strurlencodetext as string = urlencode(strurltext)
strurlencode.text = strurlencodetext
assign our test url to a variable, assign the variable to our
label control
dim strhtmltext as string = "<h1>this is a test & hopefully it
works!</h1>"
strhtml.text = strhtmltext
encode the test html, assign it to a variable, assign the
variable to our label control
dim strhtmlencodetext as string = htmlencode(strhtmltext)
strhtmlencode.text = strhtmlencodetext
end sub
</script>
</head>
<body>
<asp:label id="strurl" forecolor="red" font-bold="true" runat=server/>
<p>
<asp:label id="strurlencode" forecolor="blue" font-bold="true" runat=server/>
<p>
<asp:label id="strhtml" forecolor="red" font-bold="true" runat=server/>
<p>
<asp:label id="strhtmlencode" forecolor="blue" font-bold="true" runat=server/>
</body>
</html>
如果您觉得本文的内容对您的学习有所帮助:
关键字:
html
相关文章:
用HTML编写注释
嵌套HTML元素
空HTML元素
HTML标签与元素
HTML元素语法
通用属性
什么是属性
HTML可以做什么
HTML5-MathML
HTML5-SVG
文章分类
/ Classification
jquery教程(3860)
插件详解(9)
常用功能(20)
div+css(145)
前端开发利器(20)
html5(322)
javascript(91)
网页设计(40)
越玩越聪明(17)
算法你更懂(52)
PHP知识(37)
css3(89)
DedeCMS(1)
ASP知识(1)
数据库(7)
.net(18)
java(380)
Aui-core(0)
Android开发(2)
jquery mobile(1)
精英招纳(22)
开心一刻(8)
ci框架(2)
迅雷会员账号分享(2)
前端框架(17)
金钱谷(14)
P2P网贷系统(18)
小额贷款(5)
众筹系统(63)
催收系统(1)
瀑布流(1)
股权众筹系统(8)
回报众筹系统(0)
html5游戏(10)
网络流行语(11)
UED(8)
棒棒糖游戏中心(6)
励志名言(5)
typescript(1)
占便宜(1)
zepto(1)
好听的英文歌曲(9)
html5视频直播(3)