TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hardik Dhankecha
1.6k
110
5.3k
How to call API from controller with multiple json parameter
Jun 27 2018 4:58 AM
I want to call Web API from controller with multiple json parameter. I don't want to use ajax call for get result.
var jsonData =
"{\"jsonrpc\":2.0,"
+
"\"method\":eth_blockNumber,"
+
"\"params\":[],"
+
"\"id\":83}"
;
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(string.Format(
"https://mainnet.infura.io/qhggowRXK7HIgXB0NEyw"
,jsonData));
webreq.Method =
"POST"
;
webreq.ContentType =
"application/json"
;
using
(var streamWriter =
new
StreamWriter(webreq.GetRequestStream()))
{
JavaScriptSerializer serializer =
new
JavaScriptSerializer();
//var resToWrite = serializer.Deserialize<Dictionary<string, object>>(jsonData);
//streamWriter.Write(jsonData);
streamWriter.Flush();
streamWriter.Close();
}
WebResponse response = webreq.GetResponse();
var streamReader =
new
StreamReader(response.GetResponseStream());
var result = streamReader.ReadToEnd();
Reply
Answers (
1
)
How to get number of checked rows in a gridview using c#
textbox visible false in asp.net