Ajax DELETE never hits Web Service


#1

Hello. I’ve a simple CRUD app towards .NET REST service managing SQL Server DB. Ajax GET verb work w/o any flaw, and POST verb as well. However, trying to make DELETEs never hits my WebService, and I’m forced to use POST verb instead, so breaking REST meaning, even if it works. Can Y pls drive me to amend this behaviour? (This code desn’t work, while simply changing “DELETE” with “POST” does the trick)

Here is the code:
--------------------------------------------------NSBasic-------------------------------------------------------
URL=“http://” + txtSvr.value + “/RestSvc4Gescom/RestSvc4Gescom.svc/delecom/“
URL+=”?uid=”+txtUserId.value+"&pwd="+txtPassword.value+"&dioc=" + txtDioc2.value + “&par=” + txtParr2.value
URL+="&num=" + txtCom2.value
encURL=encodeURI(URL)
debugger
req=Ajax(encURL,“DELETE”,"")
-------------------------------------------------.NET Interface------------------------------------------------
<ServiceContract()>
Public Interface IRestSvc4Gescom

<OperationContract> <WebInvoke(Method:="DELETE", UriTemplate:="delecom/?uid={userid}&pwd={password}&dioc={dioc}&par={parr}&num={num}")>
Function RemoveCom(userid As String, password As String, dioc As String, parr As String, num As String) As Boolean

End Interface
------------------------------------------------.NET Function-----------------------------------------------
Public Class RestSvc4Gescom
Implements IRestSvc4Gescom

Function RemoveCom(userid As String, password As String, dioc As String, parr As String, num As String) As Boolean Implements IRestSvc4Gescom.RemoveCom
    Dim ctx As New CamDataContext
    Dim coms = From c In ctx.Com Where c.CodDioc = CInt(dioc) AndAlso c.CodPar = CInt(parr) AndAlso c.Numero = CInt(num)
    If coms.Count = 1 Then
        Dim com = coms.First
        ctx.Com.DeleteOnSubmit(com)
        ctx.SubmitChanges()
    End If
End Function

End Class


#2

Not only DELETE won’t work, but even PUT verb raises a 405 error!


#3

This isn’t an AppStudio issue. The 405 is coming from the server.