Ritu Singh
Problem:
I have an ASPX page, called default.aspx and default.aspx.cs being my code on the server side running on IIS 7, something really simple, written in VS Code. In addition to the JS, CSS and IMG folders (these last two have no relevance to the problem in question).
In the JS file I have a function that makes an HTTP request to the server and it should execute a certain method:
and:
At the beginning of my ASPX file, I put the tag: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="Buscar_SQL.Index" %>
Busca_SQL is my namespace and Index is my partial class.
the response to this request is this: Response {type: 'basic', url: 'http://xxx.xxx.xxx.xxx/xxxx/default.aspx/Enviar_Indicador_Novo', redirected: false, status: 200, ok: true , …}
The issue is, it does not execute the method on the server side, it only reports the response with status 200, even though it does not execute the method.
Can you help me? Is it some config in my IIS? The only thing I did with it was host and configure it to run ASPX pages.
I checked the request route and it is correct, I put the method with public static string ... and it didn't work either.
SOlution:
I not (yet) used fetch, but what you have does look correct.
Keep in mind that since you are NOT using a asmx page, but a regular aspx page with a webmethod?
Then your web method has to be static, since a whole instance of the page (code behind) class is not being created.
Hence, try this:
You also don't show in your JavaScript code where and how you set the two variables, but we have to assume they are ok, and have been setup correctly.
In addition to the above, I do suggest you check your settings in RouteConfig.cs, since you want to turn off AutoRedirect mode:
Suggested blogs:
>Why VueJs console.log giving the correct value but not updating in the template?
>How can I pass an Object as param to the router in VueJS 3 (Composition API + script setup)?
>Solve npm ERR ‘when I typed npm command "vue create vue-login-sign-ui"
>How to use useQuasar() returns undefined in pinia store file in VueJS?
>How to watch for event changes on a tailwind listbox component with Vuejs?
>How to pass input value to vue component?
>How to change the layout depending on values in the store?
>How can I show 3 items per row in Vuejs?
>Why does my Vue.js compile render function not work?