0
我不能讓我的請求參數...請求查詢爲空
我做AJAX請求通過POST方法我的服務頁面,在我的瀏覽器控制檯,請求我好喜歡sended:
localhost/Services/?target=test&action=list&from=test
發送這樣的:
$.ajax({
url: '@Url.Action(Url.Content("../Services"))',
type: 'POST',
data: "target="+$(this).attr('id')+"&action=list&from=test",
dataType: 'string',
success: OnSuccess
});
在我的控制,我試過:
var context = System.Web.HttpContext.Current;
var q = context.Request.QueryString; //empty
var q2 = context.Request.Url.Query; //empty
// or
var id = Request.QueryString["target"].ToString(); //error - sample on the following link
Get full query string in C# ASP.NET
怎麼回事?
的網址是什麼? – glautrou
你得到的錯誤是什麼 – Vignesh
可能是這個幫助你 HttpContext.Current.Request.Form [「id」] – Mohit