我有一個字符串寫入使用Web客戶端和StringBuilder的一個MSWORD文檔後運行一個頁面重定向。等到代碼執行前運行重定向
HttpContext.Current.Response.Write(strHTMLContent);
this.Page.Response.Redirect("http://www.google.com");
HttpContext.Current.Response.End();
但是,由於重定向立即發生,字符串永遠不會寫入(或沒有機會)。
我怎樣才能讓只有等到發生了串寫我重定向運行?
由於球員
這是用於生成的MSWord的代碼:
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/msword";
string strFileName = "GenerateDocument" + ".doc";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + strFileName);
StringBuilder strHTMLContent = new StringBuilder();
究竟是什麼你想在這裏做什麼?在用戶的瀏覽器中顯示strHTMLContent?或將它們重定向到http://www.google.com/? – Carson63000 2010-09-29 02:40:15
試圖示出的MSWord文檔中strHTMLContent(工作),則瀏覽器重定向至google.com – leonnz 2010-09-29 03:10:36
看到上面的代碼,用於輸出到的MSWord – leonnz 2010-09-29 03:12:10