protected void Button1_Click1(object sender, EventArgs e)
        {
            int index = ((GridViewRow)((Button)sender).NamingContainer).RowIndex;            string str = this.gvRoom_01.Rows[index].Cells[0].Text.ToString();            try
            {
                SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
                SpVoice Voice = new SpVoice();
                Voice.Speak(str, SpFlags);
            }
            catch (Exception er)
            {
                //MessageBox.Show("An Error Occured!", "SpeechApp", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }        }asp.net写了个发音代码,在本机上单击按钮可以发音,但发布到服务器后,别的机访问单击按钮就没声音了,高手知道是什么问题吗?谢谢

解决方案 »

  1.   

    SpVoiceClass voice = new SpVoiceClass();
                voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0); //其中3为中文,024为英文
                voice.Speak(richTextBox1.Text, SpeechVoiceSpeakFlags.SVSFDefault);
    这个可以读了,
      

  2.   

    LZ的ASP.net程序有强,catch的什么?
      

  3.   

    客户机没声音,本机上有声音,有谁做过asp.net的语音系统吗,特别是客户机访问也可以发音的那种
      

  4.   

    asp.net是什么?B/S架构,客户端和服务器端有什么区别,先去学习清楚你在cs里调用,当然是服务器出声了,客户端怎么可能会出声音如果希望访问网页的机器单击出声音,可以用Bgsound加js模拟,例如:
    <head> 
    <bgsound id="bgs" src="" loop="1" /> 
    <script language="javascript"> 
    function showSound() 

        // 找一个mid放在你的网站下
        document.getElementById("bgs").src = "http://localhost/click.mid"; 

    </script> 
    </head>
    <body>
    <input type=button value="testSound" onclick="showSound()"> 
    </body>
      

  5.   

    谢谢六楼提醒,现在发现问题了,但具体怎么实现呢?还是比较模糊比如我想将下面的字符串在客户机单击时读出来,应该怎么做?
    string str = this.GridView_01.Rows[index].Cells[0].Text.ToString(); 这样写只能在服务器读出来
                   SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync; 
                    SpVoice Voice = new SpVoice(); 
                    Voice.Speak(str, SpFlags); 
      

  6.   

    在CS里把7楼的脚本注册上应该就可以了!查一下MSDN,用这个ClientScriptManager.RegisterClientScriptBlock类试试吧,还有别的注册脚本的方法,看看吧