IService.cs
[OperationContract]
[WebGet(UriTemplate = \"/IsValidUser?userid={userid}&password={password}\", RequestFormat = WebMessageFo
you can write this way:
Iservice.cs
[OperationContract]
[WebGet(UriTemplate = "IsValidUser/{userid}/{password}")]
string IsValidUser(string userid, string password);
service .cs
public string IsValidUser(string userid, string password)
{
if (userid== "root" && password== "root")
{
return "True";
}
else
{
return "false";
}
}
Run this Url in Browser,then you will get output localhost/service.svc/rest/IsValidUser/root/root
Add BodyStyle on OperationContract
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
try this
[OperationContract]
[WebGet(UriTemplate = "IsValidUser?userid={userid}&password={password}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
string IsValidUser(string userid, string password);