asp.net 防注入
来源:互联网 发布:淘宝卖假货 编辑:程序博客网 时间:2024/04/30 21:51
一.如果参数全为数字:
// 检查字符串是否全为数字
public static bool IsNum(string Str)
{
bool blResult = true;
if (Str == "")
blResult = false;
else
{
foreach (char Char in Str)
{
if (!Char.IsNumber(Char))
{
blResult = false;
break;
}
}
if (blResult)
if (int.Parse(Str) == 0)
blResult = false;
}
return blResult;
}
应用:
string Topicid = Request.QueryString["Topicid"];
if (!IsNum(Topicid))
Server.Transfer("Error.aspx?ErrID=404");
二.如果参数为文本.
// Html转换
public static string htmlstr(string chr)
{
if(chr==null)
return "";
chr=chr.Replace("<","<");
chr=chr.Replace(">",">");
chr=chr.Replace("/n","<br>");
chr=chr.Replace("/"",""");
chr=chr.Replace("'","'");
chr=chr.Replace(" "," ");
chr=chr.Replace("/r","");
return(chr);
}
应用:string strClass = htmlstr(Request.QueryString["ClassName"]);
- asp.net 防注入
- Asp.net 防注入
- ASP.net防SQL注入
- ASP.net防SQL注入
- asp.net 防SQL注入
- (转)asp.net 防sql注入 .net防sql
- ASP.net防SQL注入(简单)
- ASP.net防SQL注入(简单)
- asp.net防SQL注入的安全措施
- 简单的ASP.net防SQL注入
- 简单的ASP.net防SQL注入
- 简单的ASP.net防SQL注入
- 简单的ASP.net防SQL注入
- 收集的ASP.NET 防注入攻击
- ASP.net防SQL注入(简单)
- Asp.net防注入组件的编写
- ASP.NET防SQL注入脚本程序
- asp.net的sql防注入
- Microsoft 公司 interview 時的問題!!!----三个灯泡
- 武林外传经典对话
- 在Main Thread之外的线程中更新Control的属性
- 脑筋急转弯
- Ant 和 Junit 的复用
- asp.net 防注入
- 接口和抽象类的区别
- 100句最经典台词
- EDA工具使用教程链接
- BMP文件格式分析
- 今天遇到网络骗局了,把丫丫的客服MM 好好耍了耍。。。。。。。。。。
- Asp.net中基于Forms验证的角色验证授权
- 厕所笑话
- Gaim 下使用 google talk