当在站点上传图片,也许某些原因,因OS而异,抛出的信息不一样。所以得统一处理这些信息:
Code
public static void InsusException(Exception e)
{
InsusJsUtility objInsusJsUtility = new InsusJsUtility();
if (e.Message == "Out of memory." || e.Message == "内存不足。" || e.Message == "Parameter is not valid." || e.Message == "参数无效。")
{
objInsusJsUtility.JsAlert("文件格式无效!");
}
else
{
objInsusJsUtility.JsAlert(e.Message);
}
}
上面代码中的InsusJsUtility类别,可以在这里下载:http://www.cnblogs.com/insus/articles/1341703.html