私のカスタムHtppハンドラを呼び出そうとしていて、いくつかのパラメータを渡したいのですが、httpハンドラプロセス要求メソッドでこれらのパラメータの値を取得できません。問題です 私はクライアント側jQueryコールからパラメータをHttpハンドラに渡す
$.ajax({
url: 'VideoViewValidation.ashx',
type: 'POST',
data: { 'Id': '10000', 'Type': 'Employee' },
contentType: 'application/json;charset=utf-8',
success: function (data) {
debugger;
alert('Server Method is called successfully.' + data.d);
},
error: function (errorText) {
debugger;
alert('Server Method is not called due to ' + errorText);
}
});
で
...のようなコードを使用して、これは私のカスタムのHTTPハンドラである
public class VideoViewValidation : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string videoID = string.Empty;
string id = context.Request["Id"];
string type = context.Request["Type"];
}
}
を教えてください。
ステップバイステップのチュートリアルはこちらです。http://codepedia.info/2015/05/generic-handler-ashx-file-post-send-json-data-parameters-in-asp-net-c-jquery/ –