Voice recording is not working in server
-
Hai all , I have used the folliwing code to record voice in my application. using Microsoft.VisualBasic.Devices; using Microsoft.VisualBasic;using System.Runtime.InteropServices; public partial class record : System.Web.UI.Page { [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { // record from microphone mciSendString("open new Type waveaudio Alias recsound", "", 0, 0); mciSendString("record recsound", "", 0, 0); } protected void Button2_Click(object sender, EventArgs e) { // stop and save mciSendString("save recsound c:\\lijo.wav", "", 0, 0); mciSendString("close recsound ", "", 0, 0); Computer c = new Computer(); c.Audio.Stop(); } protected void Button3_Click(object sender, EventArgs e) { Computer computer = new Computer(); computer.Audio.Play("c:\\lijo.wav", AudioPlayMode.Background); } } it is perfectly working in my local system.But when i uploaded into sver it is showing the following error. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: System.Security.Permissions.SecurityPermission Source Error: Line 28: mciSendString("record recsound", "", 0, 0); Line 29: Line 30: } Line 31: protected void Button2_Click(object sender, EventArgs e) Line 32: { plse help me its urgent. Thanks in advance regrds Lijo
-
Hai all , I have used the folliwing code to record voice in my application. using Microsoft.VisualBasic.Devices; using Microsoft.VisualBasic;using System.Runtime.InteropServices; public partial class record : System.Web.UI.Page { [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { // record from microphone mciSendString("open new Type waveaudio Alias recsound", "", 0, 0); mciSendString("record recsound", "", 0, 0); } protected void Button2_Click(object sender, EventArgs e) { // stop and save mciSendString("save recsound c:\\lijo.wav", "", 0, 0); mciSendString("close recsound ", "", 0, 0); Computer c = new Computer(); c.Audio.Stop(); } protected void Button3_Click(object sender, EventArgs e) { Computer computer = new Computer(); computer.Audio.Play("c:\\lijo.wav", AudioPlayMode.Background); } } it is perfectly working in my local system.But when i uploaded into sver it is showing the following error. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: System.Security.Permissions.SecurityPermission Source Error: Line 28: mciSendString("record recsound", "", 0, 0); Line 29: Line 30: } Line 31: protected void Button2_Click(object sender, EventArgs e) Line 32: { plse help me its urgent. Thanks in advance regrds Lijo