0

I´m having a newbie issue. It's the first time that I have deployed my .NET website to an FTP server. My website can send a contact form to reach my client. When running my website locally the mail is being sent. But after deploying it to my FTP hosting provider the call to my method stopped working. I'm given the next error:

GET http://www.mysiteURL.com/Mail/Test 404 (Not Found)

The ajax call is this

 $.ajax({
        type: "GET",
        url: "/Mail/Test" ,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: function (responseMessage) {
            toastr.success(responseMessage, "Correo Enviado");

        },
        failure: function () {
            toastr.failure('Fallo en el intento de envío. Intentelo más tarde');
        }
    });
}

Of course i have replaced the sendMessage method for Test method that only returns a string. I have my controllers folder on the root directory were my MailController is. Works perfectly fine when calling the same method but locally. I do not understand why is this.

Any lighting on the subject will be much appreciated.

Matias
  • 708
  • 10
  • 24
  • Just try with absoult URL in the ajax method url : "http://www.mysiteURL.com/Mail/Test" – Arooran Oct 16 '14 at 15:50
  • If I do it like that the request made by the ajax call is www.mysiteURL/mysiteURL/Mail/Test. I have also tried putting the complete URL " http://mysiteURL/Mail/Test" but also failed. This message was posted on the console "XMLHttpRequest cannot load http://mysiteURL/Mail/Test. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.mysiteURL' is therefore not allowed access." – Matias Oct 16 '14 at 16:02
  • I had a same problem with the MVC application after i published to live server that action method was not found. once i gave the absoult URL it worked. check this answer http://stackoverflow.com/questions/6290053/setting-access-control-allow-origin-in-asp-net-mvc-simplest-possible-method – Arooran Oct 16 '14 at 16:12
  • Not working. I do not know if this has something to do with this issue. I cant access my domain just typing the domain name, i have always need to put mysiteURL/Default.html . Perhaps this is what's happening? – Matias Oct 16 '14 at 17:57
  • Ok I have solved this last issue. Main pages in the hosting service must be called Index.html. Still I can't reach my test method. – Matias Oct 16 '14 at 20:21

1 Answers1

0

Is it not an error due to a relative Url ("/Mail/Test") broken ?

k4st0r42
  • 1,174
  • 1
  • 15
  • 29
  • Don´t think so. I have typed in the address bar [link](www.mysiteURL.com/Mail/Test) and nothing happened. I receive the Not found resource warning. But when I do the same thing locally works perfectly fine. [link] (http://localhost:7047/Mail/Test) – Matias Oct 16 '14 at 15:20