Skip to content

Speech To Text issue in web application

Pankaj Singh

Asked Apr 25, 2012, 9:13 AM EDT1 answer
Share
LinkedInX

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.. 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Chand
    0
    So, speech for both Windows and Web are different. I think you are using Windows speech in a web application. It will not work in ASP.NET. For ASP.NET, you need to look at Speech Server or VoiceXml or any other product that is designer to work on the Web.
    0