【发布时间】:2012-12-04 11:48:14
【问题描述】:
请看下面的代码。它在handler.asxh。
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
new RequestManagementFacade().PinRequest(Int32.Parse(context.Request.QueryString["requestId"]), (Boolean.Parse(context.Request.QueryString["isPinned"])));
}
这显示以下错误:
Value cannot be null. Parameter name: String
当我检查了上下文请求查询字符串时,有值被传递,但是,代码在这个阶段中断了。
这个处理程序将连接到业务逻辑层。
【问题讨论】:
-
肯定 requestId 或 isPinned 为空,评估它们并捕获一些错误!
标签: c# exception handler request.querystring nul