コード例 #1
0
ファイル: sayit.ashx.cs プロジェクト: pigivc/AudioCaptchaCore
        public async Task ProcessRequestAsync(HttpContext context)
        {
            var key      = Extensions._captchaPrefix + context.Request.Query["id"];
            var cSetting = AppContext.Current.Session.Get <CaptchaSettings>(key);

            byte[] bytes = new byte[0];
            if (cSetting.EnableAudio)
            {
                bytes = await CaptchaManager.GenerateCurrentCaptachAudio(key);
            }
            context.Response.Clear();
            context.Response.ContentType = "audio/mp3";

            await context.Response.Body.WriteAsync(bytes, 0, bytes.Length);
        }
コード例 #2
0
ファイル: sayit.ashx.cs プロジェクト: pigivc/AudioCaptcha
        public override async Task ProcessRequestAsync(HttpContext context)
        {
            //"".CreateAudio();

            var key      = Extensions._captchaPrefix + context.Request.QueryString["id"];
            var cSetting = (CaptchaSettings)HttpContext.Current.Session[key];

            byte[] bytes = new byte[0];
            if (cSetting.EnableAudio)
            {
                bytes = await CaptchaManager.GenerateCurrentCaptachAudio(key);
            }
            //var cbytes = bytes.CompressWav();
            context.Response.OutputStream.Write(bytes, 0, bytes.Length);
            context.Response.ContentType = "audio/mp3";
            //context.Response.Write("Hello World");
        }