What possibly is wrong? thanks.
XAML:
Code: Select all
<Page
x:Class="MyApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<StackPanel>
<TextBlock x:Name="textBlock" HorizontalAlignment="Center"/>
<Button Click="LoadButton_Click" HorizontalAlignment="Center" Content="Load"/>
</StackPanel>
</Grid>
</Page>
C#
Code: Select all
private async void LoadButton_Click(object sender, RoutedEventArgs e)
{
var webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
textBlock.Text = "loading";
string response = await webClient.DownloadStringTaskAsync("http://www.google.com");
textBlock.Text = response;
}