输入字符串的格式不正确MVC

时间:2016-02-05 18:43:09

标签: asp.net-mvc linq entity-framework-4

我只想将Session [“Price”]转换为十进制并将Session [“Count”]转换为整数

        doc.Price = Convert.ToDecimal(Session["Price"]);
        doc.Count = Convert.ToInt16(Session["Count"]); 

我收到此错误 enter image description here

1 个答案:

答案 0 :(得分:0)

{{1}}

这个问题在整体上就是你没有练习防御性编码。去了解防御性编码,它将提高代码的质量