查看這篇帖子Response.Redirect 發現的問題
1:採用ajax方式提交給IHttpHander
因爲你是使用的異步請求的方式,頁面自然不會跳轉(帖子已經說明),這個時候context 對象應該被掛起了吧
要想跳轉 可採用
a:IHttpHander 的返回值在跳轉
b:
context.Response.Write(string.Format("window.location.href='{0}';", “你跳轉的路徑"));
如果web.config 中添加
<add verb="*" path="*.ashx" type=" System.Web.IHttpHandler"/>
b方式也無法跳轉(已經測試過,不知道原因,可能更IHttpHander 請求關聯...)
2:當然就是非ajax方式請求 IHttpHander 中的
context.Response.Redirect
是ok的 千萬不要採用上面的b方式 因爲那是直接輸出 到當前頁面
window.location.href=‘你跳轉的路徑’