public string HtmlDecode(string str)
{
if ((str.Trim()!="") || (str.Trim()!=null))
{
str.Replace(">",">");
str.Replace("<","<");
str.Replace(" ",Chr(32));
str.Replace(" ",Chr(9));
str.Replace(""",Chr(34));
str=Replace("'",Chr(39));
str.Replace("",Chr(13));
str.Replace("</p><p>",Chr(10)+ Chr(10));
str.Replace("<br> ",Chr(10));
return str;
}
}编译不能通过,chr在名称空间中不存在,怎么办呀?
{
if ((str.Trim()!="") || (str.Trim()!=null))
{
str.Replace(">",">");
str.Replace("<","<");
str.Replace(" ",Chr(32));
str.Replace(" ",Chr(9));
str.Replace(""",Chr(34));
str=Replace("'",Chr(39));
str.Replace("",Chr(13));
str.Replace("</p><p>",Chr(10)+ Chr(10));
str.Replace("<br> ",Chr(10));
return str;
}
}编译不能通过,chr在名称空间中不存在,怎么办呀?
解决方案 »
- 关于google map问题,标题要~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~长
- 微软发布ASP.NET安全更新了,简述POET,有代码求真相
- 自定义控制DropDownList的DataTextField
- 插入问题重复问题,急??
- SQL语句有错误 望大侠帮忙解决。
- post图片
- 一个有趣的多线程问题...不知道有没有朋友进来试试
- datagrid的问题
- 请drk928(一起看斜阳)、lutao206(海口冰玲) 、 dragonforfly(飘零)三位到此再次领分。
- DataGrid 中的一整行超连接,怎么做?在线等
- 用VS.Net开发web应用程序时,界面如何美化呢
- 为什么这样写可以赋值,这样写就不能赋值??
strParamer = Replace(strParamer, "&", "&")
strParamer = Replace(strParamer, "'", "''")
strParamer = Replace(strParamer, " ", " ")
strParamer = Replace(strParamer, "<", "<")
strParamer = Replace(strParamer, ">", ">")
strParamer = Replace(strParamer, "\n", "<br>")
Return strParamer
End Function
Public Function Decode(ByVal strParamer As String) As String
strParamer = Replace(strParamer, "<br>", "\n")
strParamer = Replace(strParamer, ">", ">")
strParamer = Replace(strParamer, "<", "<")
strParamer = Replace(strParamer, " ", " ")
strParamer = Replace(strParamer, "''", "'")
strParamer = Replace(strParamer, "&", "&")
Return strParamer
End Function
Server.HtmlDecode();.Net自带的。
CHR是VB(VB.net里有没有不知道)的函数.其实楼主不用弄这么多,我就只换四个:< > ' \r\n
不知道各位有什么意见.转换了这四个,目前来说,我认为SQL和JS都攻不进来了.
学习ING~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
主要还有一个在发新闻的时候保持排版的问题!谢谢楼上的各位师兄!
这样又安全(目前我还看不出来有什么不妥),又能保持排版,还是很的直观