Can webmethod have HttpContext?

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
    }

This never works but if i replace url: "Default.aspx/UPLOAD", with url: "Handler.ashx", it would work flawlessly. Is it not possible to do the same using webmethods? If not, why? If yes, how?


Source: .net

Leave a Reply