Pankaj Singh

Pankaj Singh

  • NA
  • 97
  • 0

Speech To Text issue in web application

Apr 25 2012 1:13 PM

Hi ,

I am using following code and get an error message::

Code::

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SpeechLib;
using System.Speech;
using System.Speech.Recognition;
public partial class _Default : System.Web.UI.Page
{
SpeechRecognizer rec = new SpeechRecognizer();
protected void Page_Load(object sender, EventArgs e)
{
VoiceContent();

}

private void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
TextBox1.Text += e.Result.Text;
}
private void VoiceContent()
{
var c = new Choices();
for (var i = 0; i < 10; i++)
c.Add(i.ToString());
    // etc...
var gb = new GrammarBuilder(c);
var g = new Grammar(gb);
rec.LoadGrammar(g);
rec.Enabled = true;
}

}

error message::

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.

Please help me

Thanks in advance.. 



Answers (1)