如何调用在.ashx文件上添加第二个方法

时间:2015-10-08 01:50:14

标签: javascript c# ashx

我有一种播放语音音频的方法,但目前这种方法只播放一种语言。 我想调用另一个方法,它将执行相同的功能,但是对于另一种语言,而不是一个不同的文件。

我的档案:

public class AudioHandler : IHttpHandler
{
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

    public void ProcessRequest(HttpContext context)
    {
        int id = Convert.ToInt32(context.Request.QueryString["id"]);
        byte[] bytes = new byte[0];
        using (The_FactoryDBContext db = new The_FactoryDBContext())
        {
    bytes = db.Words.FirstOrDefault(word => word.wordID == id).engAudio; // here will be the change in the second method .afrAudio

                context.Response.ContentType = "audio/wav";
                context.Response.BinaryWrite(bytes);
                context.Response.Flush();
            //}
        }
    }
}

}

我如何调用第二种方法?

这就是我调用这个处理程序的方式:

audio.src = "/AudioHandler.ashx?id=" + id;

如果有第二种方法,它会有什么不同

由于

0 个答案:

没有答案