检查URL参数是否合法
string combinationID = Request.QueryString["CombinationID"];
string buyingPriceListID = Request.QueryString["PriceListID"];
if (combinationID != null && CommonFunction.IsInt(combinationID) && combinationID.Length < int.MaxValue.ToString().Length)
{
m_CombinationID = int.Parse(combinationID.ToString());
}
if (buyingPriceListID != null && CommonFunction.IsInt(buyingPriceListID) && buyingPriceListID.Length < int.MaxValue.ToString().Length)
{
m_BuyingPriceListID = int.Parse(buyingPriceListID.ToString());
}
string buyingPriceListID = Request.QueryString["PriceListID"];
if (combinationID != null && CommonFunction.IsInt(combinationID) && combinationID.Length < int.MaxValue.ToString().Length)
{
m_CombinationID = int.Parse(combinationID.ToString());
}
if (buyingPriceListID != null && CommonFunction.IsInt(buyingPriceListID) && buyingPriceListID.Length < int.MaxValue.ToString().Length)
{
m_BuyingPriceListID = int.Parse(buyingPriceListID.ToString());
}
public static bool IsInt(string input)
{
return Regex.IsMatch(input, @"^\d+$");
}
{
return Regex.IsMatch(input, @"^\d+$");
}
string script = "<script type='text/javascript'>alert('{0}');window.location.href='BuyingPriceList.aspx';</script>";
if (this.m_CombinationID == 0 || !entityCombination.ObjectExist)
{
script = string.Format(script, this.getMessage("M10022"));
Response.Write(script);
Response.End();
}
if (this.m_BuyingPriceListID == 0 || !entityBPList.ObjectExist)
{
script = string.Format(script, this.getMessage("M10023"));
Response.Write(script);
Response.End();
}
if (this.m_CombinationID == 0 || !entityCombination.ObjectExist)
{
script = string.Format(script, this.getMessage("M10022"));
Response.Write(script);
Response.End();
}
if (this.m_BuyingPriceListID == 0 || !entityBPList.ObjectExist)
{
script = string.Format(script, this.getMessage("M10023"));
Response.Write(script);
Response.End();
}
【推荐】中国电信天翼云云端翼购节,2核2G云服务器一口价38元/年
【推荐】博客园携手 AI 驱动开发工具商 Chat2DB 推出联合终身会员
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步