Voice recording on ASP.NET

  • Thread starter Thread starter Yasintha Srimanthi
  • Start date Start date
Y

Yasintha Srimanthi

Guest
I am using winmm.dll to record audio from user and save it in to directory. Every thing was work fine but after publishing using URL it says, the audio file was not found. Path is correct but the audio is not saving.

[DllImport("winmm.dll", EntryPoint = "mciSendStringA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int record(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

protected void btnStopRecording_Click(object sender, EventArgs e)
{
try
{
lblRecording.Visible = false;
string userId = Request.QueryString["id"];
timer.Enabled = false;
string path = Server.MapPath(@"~/Recordings/'" + userId + "'(1).wav");
path = path.First().ToString().ToLower() + path.Substring(1);
record("save recsound " + path, "", 0, 0);
record("close recsound", "", 0, 0);
btnStartRec.Enabled = false;
btnStopRecording.Enabled = false;
btnSave.Enabled = true;
}
catch (Exception)
{

throw;
}
}
Can anyone help me with the issue.



Server Error in '/' Application.

Could not find file 'c:\inetpub\wwwroot\VoiceAuthentication\Recordings\'usr_a0529bb472f54d85bb0feb1908f46e51'(1).wav'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not find file 'c:\inetpub\wwwroot\VoiceAuthentication\Recordings\'usr_a0529bb472f54d85bb0feb1908f46e51'(1).wav'.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FileNotFoundException: Could not find file 'c:\inetpub\wwwroot\VoiceAuthentication\Recordings\'usr_a0529bb472f54d85bb0feb1908f46e51'(1).wav'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1344
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1217
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +144
System.IO.File.InternalReadAllBytes(String path, Boolean checkHost) +122
VoiceAuthantication.VoiceRecord.RecordingWebForm.btnSave_Click(Object sender, EventArgs e) in D:\VoiceAuthantication\VoiceAuthantication\VoiceRecord\RecordingWebForm.aspx.cs:175
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11758656
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5028


Continue reading...
 
Back
Top