I hope you can help, im trying to upgrade a broken login system so it uses POST instead of GET when transffering login credentials.
It never reaches the actual method so the problem is somewhere between the interface and my javascript.
Interface:
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "/DoLogin")]
LoginKey DoLogin(string email, string password,string tenant);
Javascript:
$.ajax({
type: "POST",
url: "RestService.svc/DoLogin",
data:'{"email":"' + encodeURIComponent(email) + '","password":"' + encodeURIComponent(password) + '","tenant":"' + encodeURIComponent(tenant) + '"}',
dataType: "json",
cache: false,
success: function (loginKey) {
... rest of method
The JSON data i send is valid: { "email": "mail", "password": "somepassword", "tenant": "tenantid" } Any ideas whats going wrong here? It worked just fine with GET
ps here is the first line of the actual login rest service method:
public LoginKey DoLogin(string email, string password, string tenant)
{