Error tn/7 and page not found 404 after first succesfull call

Error tn/7 and page not found 404 after first succesfull call

calwayNLcalwayNL Posts: 4Questions: 1Answers: 0

I am receiving a page not found error in the console windows of the browser and the tn/7 error from datatables. The strange thing is the first page works, and if I copy paste the 404 url and enter it in the browser it also works. I do notice that the url is very large more then 2200 bytes long where the origional url is ervery short. It must have something to to with server-side pagina which is enabled.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin
    Answer ✓

    Try sending the request as a POST method. Some servers have a limit on the number of characters in the query string.

    Allan

  • calwayNLcalwayNL Posts: 4Questions: 1Answers: 0

    Solved it. I was not using POST, I was calling the ajax like this, which resulted in a GET:

    $('#ContactList').DataTable({
    "processing": true,
    "serverSide": true,
    "ajax": "/services/GetCustomerContacts.ashx?customerid=<%= CurrentCustomer.ResID %>",
    "dom": "ftp",
    ....

    While the number of columns was small enough this was not a problem, but under the covers the querystring was expanded with a lot of extra data. When I added another (9th) column the querystring just got to large (it seems) and in the internals of the ajax call this led to the tn/7 ajax error. Once I change the "ajax" part to:

    "ajax": {
    "url": "/services/GetCustomerContacts.ashx?customerid=<%= CurrentCustomer.ResID %>",
    "type": "POST",
    },

    Everything worked again and the querystring was reduced to just the basic url i supply in the url paramater. This tn/7 error is very very generic and can put you on a wrong path. Using the console window of the browser it gave a 404 error, but the url itself is correct -- and exists -- it's just the parameters make it too long to process.
    If I cut-paste the url from the console window to the browser, the browser cuts of at the maximum length your browser allows and then there is no problem calling it. Even half the url still works at least it returns data.

    Anyway it's solved but when using "serverside" : true make sure you change the ajax call to a POST.

  • calwayNLcalwayNL Posts: 4Questions: 1Answers: 0

    @allan I was just typing the solution when your reply came in :-)

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    ....when using "serverside" : true make sure you change the ajax call to a POST.

    Wrong. I regularly use GET with no problem. Circumstances differ greatly from one usage to another.

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin

    I've gone through several periods when I've wished that I had made the default POST because of exactly this issue. However, is a REST interface this is a GET action, so I believe the default to be correct.

    It is configurable to allow for different use cases.

    Allan

This discussion has been closed.