Hi there,
(That sounded like a world of warcraft NPC, anyway)
I have been struggling a bit with a home project that I am trying to figure out.
I want to use System.Speech.Synthesis in a web page but it gives me the following error.
Asynchronous operations are not allowed in this context. Page starting an asynchronous operation has to have the Async attribute set to true and an asynchronous operation can only be started on a page prior to PreRenderComplete event.
To be honest I have no idea what to do, here is what I have
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Speech.Synthesis;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.SpeakAsync(TextBox1.Text);
}
}
When the button is clicked, it should read what ever is in the textbox.
I have done this multiple times for windows applications, but never before for a web application.
Does anyone have a suggestion for me?
Any advice is welcome.
Thanks,
Harry Neethling