2015-03-02 36 views
1

我想傳遞這個查詢字符串到一些aspx文件(WebForm1.aspx)。但在這裏我無法通過它。這是MVC5應用程序。一切工作,但response.redirect不工作Response.Redirect裏面JsonResult

public JsonResult SubmitReportData(SelectedReportViewModel SubmitData) 
    { 
     Response.Redirect("~/Report/WebForm1.aspx?Id="+SubmitData.SelectedNode+"&stDate="+SubmitData.stDate+"&enDate"+SubmitData.enDate); 



     //return Json(new { x = 1 }); 
     return null; 

    } 
+0

可以返回的路徑string和使用window.location.href = '您的路徑' 在jQuery的重定向。 – 2015-03-02 05:23:43

+0

@sehtaumesh當我使用它,然後它顯示'名稱窗口不存在於當前上下文' – Alex 2015-03-02 05:25:14

+0

可能重複的http://stackoverflow.com/questions/199099/how-to-manage-a-redirect- request-after-a-jquery-ajax-call – 2015-03-02 05:26:17

回答

5

可以在jQuery的返回路徑字符串,並使用盡可能

window.location.href='Your Path'; 

重定向到另一個頁面。

如:

public JsonResult SubmitReportData(SelectedReportViewModel SubmitData) 
{ 
    string path="~/Report/WebForm1.aspx?Id="+SubmitData.SelectedNode+"&stDate="+SubmitData.stDate+"&enDate"+SubmitData.enDate; 
    return Json(path,JsonRequestBehavior.AllowGet); 
}