I have an mvc application in .net 4.8 framework Everything is working fine on local development environment but when I host it on server , every ajax call , images shows 404. Below is my findings.
Under IIS we have a named website and under that website we have a application, our code is deployed inside application and the below is how the url looks like when it show 404
https://example.com/Controller/ActionMethod
After adding ApplicationName it works
https://example.com/ApplicationName/Controller/ActionMethod
Below is my ajax call
var url = '/Controller/ActionMethod
$.ajax({
type: "POST",
url: url,
data: JSON.stringify(data),
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data) {},
error: function (xhr, status, error) {}
});
Why ApplicationName is not part of any url (ajax , image) here, can someone suggest what changes I have to make here ? Below is the current and expected url
Current
https://example.com/Controller/ActionMethod
Expected