public JsonResult Submit() { if (!Permission.LoginedNeed(Request, Response, Session)) { return(Json(false)); } int eid = Convert.ToInt32(Request["eid"]); User user = (User)Session["user"]; int number = Convert.ToInt32(Request["number"]); string content = "<exam>"; for (var i = 1; i <= number; i++) { string answer = Request["q" + i]; content += "<question><number>" + i + "</number><answer>" + answer + "</answer></question>"; } content += "</exam>"; string filename = Server.MapPath("/result/") + DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss") + ".xml"; if (!FileOperation.CreateFile(filename, content)) { return(Json(false)); } Result result = new Result { uid = user.uid, eid = eid, answer = filename, reviewer = 1, score = -1 }; return(Json(ResultView.AddResult(result))); }