asp.net如何将数据库的html代码调用出来时进行显示

asp.net如何将数据库的html代码调用出来时进行显示,第1张

public static string Nohtml(string Htmlstr, int leng)

{

string Htmlstring = stringEmpty;

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"<script[^>]></script>", "", RegexOptionsIgnoreCase);

//删除HTML

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"<([^>])>", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"([\r\n])[\s]+", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"-->", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"<!--", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(quot|#34);", "\"", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(amp|#38);", "&", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(lt|#60);", "<", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(gt|#62);", ">", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(nbsp|#160);", " ", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(iexcl|#161);", "\xa1", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(cent|#162);", "\xa2", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(pound|#163);", "\xa3", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"&(copy|#169);", "\xa9", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, @"(\d+);", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, "xp_cmdshell", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, ">", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, "<", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, "<p>", "", RegexOptionsIgnoreCase);

Htmlstr = SystemTextRegularExpressionsRegexReplace(Htmlstr, "</p>", "", RegexOptionsIgnoreCase);

////删除与数据相关的词

//Htmlstring = RegexReplace(Htmlstring, "select", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "insert", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "delete from", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "count''", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "drop table", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "truncate", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "asc", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "mid", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "char", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "xp_cmdshell", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "exec master", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "net localgroup administrators", "", RegexOptionsIgnoreCase);

//Htmlstring = RegexReplace(Htmlstring, "and", "", RegexOptionsIgnoreCase);

Htmlstring = SubString(Htmlstr, leng);

return Htmlstring;

}

输出的时候先处理一下。 但是不要改动数据库不然变不回去了。

首先,你提到的Java Servlet是用来提供数据的,ajax是用来获取数据的。

1、后端用servlet、struts、springmvc等从数据库取数据并转换成json格式返回,前端用ajax获取这些json数据。

2、后端用servlet、struts、springmvc等从数据库取数据并将数据嵌到模板页面里,前端用jsp、freemarker之类的模板语言直接写for循环。

1、sudo su postgres指令进入postgres。

2、\c test\dt\d首先查看一下有的表格。

3、准备好sql文件。

4、SELECT FROM person先查看一下表格的内容。

5、\i /home/coffee/Downloads/personsql导入文件,如果出现错误,没关系,继续往下看。

6、DROP TABLE person;如果不想要表格,可以这样删除。再导入一次。

以上就是关于asp.net如何将数据库的html代码调用出来时进行显示全部的内容,包括:asp.net如何将数据库的html代码调用出来时进行显示、html5网页显示数据库内容、怎样从HTML网页中获取SQL数据库里的数据等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10156204.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存