Error when accesing .ashx file in asp.net

529 views Asked by At

Goal: Created client.ashx by copying existing and working product.ashx and renaming into client.ashx Modified client.ashx to handle similar logic to product.ashx

I did the above since I don't know how to create an .ashx from scratch in visual studio community. I didn't see a file option for .ashx after the Add/New Item ...

The goal is to upload client images using client.ashx. File product.ashx uploads product images.

My jscript call to product.ashx works as usual, although when I call the new client.ashx it seems to call product.ashx rather than client.ashx

Sample call to client.ashx

 $.ajax({
        type: "POST",
        url: "/handlers/client.ashx",
        data: formData,
        global: false,
        success: function (result) {

            var response = JSON.parse(result);
            var success = response.Success;

            if (success) {
                window.location.replace(window.location);
            }
            else {
                ChangeStatusMessage(response.Message, false, true);
            }
        },
        processData: false,
        contentType: false,
        error: function (result) {
            ChangeStatusMessage("An unknown error occurred while trying to upload the image.  Please reload the page and try again", false, true);
        }
    });
0

There are 0 answers