1. I have on requirement to display live currency data and sencex data in my web application is their any free api to get the information.
2. I need to send otp to user i have two types of sanple code but it's does not working can give me the solution. i will share the code.
Thanks in advance
#1
- Public string APICall(strig url)
- {
- WebClient client = new WebClient();
- Stream s = client.OpenRead(string.Format(url));
- StreamReader reader = new StreamReader(s);
- string result = reader.ReadToEnd();
- return result;
-
- }
- [HttpPost]
- public string GetSecuredData(string userName)
- {
- string url = "Here I am passing the url";
- string securedInfo = "";
- string js = Apicall(url);
- if (js != "0")
- securedInfo = "OTP Send Success";
- else
- securedInfo = "please try again.";
- return securedInfo;
- }
#2 Model
- public String Apicall(string url)
- {
- HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);
- try
- {
- HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();
- StreamReader sr = new StreamReader(httpres.GetResponseStream());
- string results = sr.ReadToEnd();
- sr.Close();
- return results;
- catch
- {
- return "0";
- }
- [HttpPost]
- public string GetSecuredData(string userName)
- {
- string url = "Passing url"
- string js = Apicall(url);
- if (js != "0")
- securedInfo = "OTP Send Success";
- else
- securedInfo = "please try again.";
- return securedInfo;
- }