1

I am fairly new to web forms. I am using custom file upload component. I would like to upload file in a specific folder of my local machine and I have written code in the Default.aspx.cs file instead of Default.ahsx page. The file which I upload is uploaded successfully(UI level only) and I'm getting wondered, I cannot able to get the file in code behind (i.e., in aspx.cs file). Breakpoints also not hit. In the Network tab of browser, status code is returned as 200.

Here is what I've tried.

My aspx.cs file

 public static object Save(HttpContext context)

    {
     // Debugger is not hitting 

        <Code to save file>
        return "";

    }

Aspx file

<div id="app">
        <custom-uploader :async-settings="path"></custom-uploader>
    </div>
    <script>

        Vue.use(customUploader.UploaderPlugin);
        new Vue({
            el: '#app',
            data: function () {
                return {
                    path: {
                        saveUrl: 'Default.aspx/Save',
                        removeUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'
                    }
                }
            }
        });
    </script>

Any help would be greatly appreciated.

Jeyanth
  • 531
  • 2
  • 6
  • 19
  • Do you get any errors in the javascript console of your browser? – Hans Kesting Jan 08 '20 at 13:37
  • There are several articles on this topic https://stackoverflow.com/questions/673075/net-ajax-calls-to-asmx-or-aspx-or-ashx https://www.dotnetcurry.com/ShowArticle.aspx?ID=109 https://stackoverflow.com/questions/3713/call-asp-net-function-from-javascript – B. Lec Jan 08 '20 at 13:49
  • I don't get any error in console. The thing I found was GET is 200 OK whereas POST is 301 Moved Permanently. – Jeyanth Jan 09 '20 at 04:38
  • Anyone please help to resolve this. – Jeyanth Aug 19 '20 at 15:00

0 Answers0