Last post Nov 16, 2015 05:39 AM by xiemosi
Nov 15, 2015 09:11 PM|xiemosi|LINK
I followed this tutorial:http://www.mikesdotnetting.com/article/159/webmatrix-protecting-your-web-pages-site
created a new folder named "App_Code"
and created a new file named "HtmlSanitizer.cs", placed some c# code in it, including public of AssafeHtml
after that I created a new file to display a column in the database, codes like below:
var db=Database.Open("database name");
var sql= db.QuerySingle("SELECT * from test order by id desc");
var qq= sql.columnname;
var qqq= new HtmlString(qqq.ToString().AssafeHtml());
When I run it in browser, the yellow screen of death is appeared.
It mention me:
How can I do?
thanks for your help!
Nov 16, 2015 02:21 AM|Mikesdotnetting|LINK
string qqq = new HtmlString(qq.AssafeHtml());
var qqq = new HtmlString(((string)qq).AssafeHtml());
Nov 16, 2015 05:39 AM|xiemosi|LINK
Thank you Mike!
The second expression did work!