必须先判断对象不为空,否则会报空指针错误。

Request.QueryString["name"] != null && Request.QueryString["name"] != ""

fupPicture.PostedFile != null && fupPicture.PostedFile.ContentLength > 0

原文地址:https://www.cnblogs.com/whlhaikuotiankong/p/1976848.html