I wish to call the get function from a button click on my web application
my code in my application is
protected void btngetbtanches_Click(object sender, EventArgs e)
{
try
{
HttpWebRequest req = WebRequest.Create(@"http://localhost:54691/") as HttpWebRequest;
WebResponse resp = req.GetResponse();
using (Stream branchstream = resp.GetResponseStream())
{
StreamReader loResponseStream =
new StreamReader(branchstream, Encoding.UTF8);
string Response = loResponseStream.ReadToEnd();
loResponseStream.Close();
resp.Close();
}
}
catch (Exception ex)
{
}
}
in my service is
[ServiceContract]
public interface IRestSerivce
{
[OperationContract]
[WebGet(UriTemplate = "Default")]
string GetBranchData();
}
}
}
get data is defined in another file in the service project. When I try to click the button some html is returned and the service is not called.
Any help would be appreciated