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 failing to execute the url and get the CSV.
Apr 24 2017 6:10 AM
HI,
Following code is failing at WebClient statement. I am not able to get the csv from API.
private
static
async Task<
double
?> GetStockPriceAsync(
string
symbol)
{
if
(
string
.IsNullOrWhiteSpace(symbol))
return
null
;
string
url = $
"http://finance.yahoo.com/d/quotes.csv?s={symbol}&f=l1"
;
string
csv;
using
(WebClient client =
new
WebClient())
{
csv = await client.DownloadStringTaskAsync(url).ConfigureAwait(
false
);
}
string
line = csv.Split(
'\n'
)[0];
string
price = line.Split(
','
)[1];
double
result;
if
(
double
.TryParse(price,
out
result))
return
result;
return
null
;
}
help me with the new statement that will work apart from
WebClient.
Reply
Answers (
3
)
Error 227 Entering into the passive mode
SpeakAsync(text) C#