How to call service from another application with ServiceAuthorize?
Please help me.
Thanks.
The ServiceAuthorize() attribute is part of the permissions system _inside_ of Serenity. When placed above a controller method in XYZEndpoint.cs, it checks that the user is currently logged in. If you're going to call a service from an external application, you'll have to add the service to your controller manually.
Use JsonServiceClient from Serenity.Services:
var client = new JsonServiceClient("http://www.mysite.com/");
var client = new JsonServiceClient("http://www.mysite.com/");
client.Post<ServiceResponse>("Account/Login",
new LoginRequest {
Username = "someuser",
Password = "somepass"
});
var list = client.Post<ListResponse<Dictionary<string, object>>>(
"Services/Northwind/Customer/List",
new ListRequest {
Take = 100
});
Thanks mr. volkanceylan
Hey @volkanceylan It's possible install Serenity.Services in Xamarin? I have some problems... Thanks
Take code for ServiceClient, modify it a bit.
Hi,
I am getting an error on new LoginRequest how to create this object?? or am I missing any reference??
Most helpful comment
Use JsonServiceClient from Serenity.Services: