'Can't fetch from js after deployment to IIS - 404 not found
i try to make http post request to my controller from the js. In localhost everything works perfectly, but when I deploy app on IIS, then fetch cut some part of path and return 404 not found.
Application is deploy on: https://example.com/ApplicationName/
Fetch url is: https://example.com/Home/Update/?switcher=false
But should be: https://example.com/ApplicationName/Home/Update/?switcher=false
Fetch:
let url = '/Home/Update/?switcher=' + switcher;
await fetch(url, {
method: 'POST'
})
.then(function (response) {
if (response) {
toggleChatSwitch.disabled = false;
}
});
Controller:
[HttpPost]
public bool Update(bool switcher)
{
[...]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
