public void ProcessRequest(HttpContext context)
{
string method = context.Request["method"];
if (!string.IsNullOrEmpty(method))
{
switch (method)
{
case "getReportGroups":
{
long projectId = long.Parse(context.Request.Params["projectId"]);
if (projectId > 0)
SerializeResults(getReportGroups(projectId), null, false, context);
else
{
ThrowInvalidProjectIdException(projectId);
}
}
}}
我想验证在变量“long projectId”中检索并存储的 projectId。如果假设它作为字符串或其他东西传递,我会遇到异常。那么如何验证呢。