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
Ms_ Dev
NA
236
92.1k
WebClient is giving exception
Apr 26 2017 12:38 AM
Hi,
WebClient is giving exception. It is not able to get the data in
ResultInCSV.
try
{
string
ServiceURL = $
"http://finance.yahoo.com/d/quotes.csv?s={symbol}&f=sl1d1nd"
;
string
ResultInCSV;
using
(WebClient client =
new
WebClient())
{
ResultInCSV = await client.DownloadStringTaskAsync(ServiceURL).ConfigureAwait(
false
);
}
var FirstLine = ResultInCSV.Split(
'\n'
)[0];
var Price = FirstLine.Split(
','
)[1];
if
(Price !=
null
&& Price.Length >= 0)
{
double
result;
if
(
double
.TryParse(Price,
out
result))
{
return
result;
}
}
return
null
;
}
catch
(WebException ex)
{
throw
ex.InnerException;
}
}
Please help to get the data.
Thanks,
Reply
Answers (
9
)
convert a jpg/png/txt or any file format to pdf using mvc5
how to download mysqldatabase table to excel format using c#