webmethod可以有HttpContext吗?

时间:2015-05-23 08:13:29

标签: c# jquery asp.net .net

ASPX:

<script type="text/javascript">
      $(document).ready(function () {
       var uploadObj  =  $("#fileuploader").uploadFile({
           url: "Default.aspx/UPLOAD",
              fileName: "myfile",
              formData: { "name": "Ravi", "age": 31 },
              autoSubmit: false
          });

          $("#btngo").click(function (e) {
              uploadObj.startUpload();
              e.preventDefault();
          });
      });


  </script>

CodeBehid

[WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public void UPLOAD(HttpContext context)
    {

        //break point not hit
    }

这永远不会有效,但如果我用url: "Default.aspx/UPLOAD",替换url: "Handler.ashx",,它将完美无缺。是不是可以使用webmethods做同样的事情?如果没有,为什么?如果是,怎么样?

0 个答案:

没有答案