I have a HyperlinkButton in my Silverlight project. Clicking the link will open the URL in a new page:
<HyperlinkButton x:Name="Button1" Content="Click"
TargetName="_blank" Click="Button1_Click"
NavigateUri="http://www.example.com" />
When I click the button, I want a (second) asynchronous request to be fired to a statistics server:
private void Button1_Click(object sender, RoutedEventArgs e)
{
WebClient webClient = new WebClient();
webClient.Headers["content-type"] = "application/x-www-form-urlencoded";
webClient.Encoding = Encoding.UTF8;
webClient.UploadStringAsync(destURI, "POST", "action=click" +
"&id=" + id);
}
However, if I check with FireBug, this request is never fired. How can I make this request work?
Note: I have already checked that the destination page can receive requests. The destination has a correct clientaccesspolicy.xml
and crossdomain.xml
.