asp.net responseдÎļþ
protected void Button2_Click(object sender, EventArgs e)
{
bool ok = true;
string fileName;
fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
try
{
Response.ClearHeaders();
Response.ContentType = "application/msword;";
Response.Charset = "UTF-8";
Response.AddHeader("Content-Disposition", string.Format("attachment;filename=\"{0}\"", fileName));
Response.BinaryWrite(Encoding.Default.GetBytes(strr));
}
catch (Exception ex)
{
ok = false;
Response.Write("Éú³ÉÎļþʧ°Ü£º" + ex.Message + "£¬ÇëÉÔºóÔÙÊÔ¡£");
CreateGbpt(fileName, strr);
}
if (ok)
{
Response.End();
}
}
private void CreateFile(string fileName, string text)
{
bool ok = true;
string filePath;
&
Ïà¹ØÎĵµ£º
ASP.NETÌṩÁËʼþÇý¶¯±à³ÌÄ£ÐÍ£¬Ê¹¿ª·¢Õß¼ò»¯ÁËÓ¦ÓóÌÐòµÄ×ÜÌåÉè¼Æ£¬µ«ÊÇÕâ¸öÒ²Ôì³ÉÁËËü¹ÌÓеÄһЩÎÊÌ⣬ÀýÈ磬ÔÚ´«Í³µÄASPÀÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃPOST·½·¨ºÜÈÝÒ×µØÊµÏÖÒ³Ãæ¼ä´«µÝ±äÁ¿£¬Í¬ÑùµÄÊÂÇ飬ÔÚʹÓÃʼþÇý¶¯±à³ÌÄ£Ð͵ÄASP.NET¾ÍÒªÂ鷳һЩ£¬µ«ÊÇÎÒÃÇÈÔÈ»ÓÐһЩ·½·¨¿ÉÒÔʵÏÖͬÑùµÄ¹¦ÄÜ¡£±ÊÕßÔÚÕâÀォ°üº¬Ê¹ÓÃque ......
½ñÌìͻȻÓöµ½Õâ¸öÎÊÌâÁË£¡²»¹ýË¢ÐÂÒ³Ãæºó´íÎó¾ÍûÓУ¡ ¶øÇÒ֮ǰҲûÓÐÕâ¸ö´íÎóŶ£¡ ... ²»¹ýÎÒ»¹ÊÇÈ¥GoogleÁËһϴ𰸣¡
Thread was being aborted :ÖÐÎÄÒâ˼ Ï̱߳»ÖÕÖ¹
ÒýÓõØÖ·£ºhttp://support.microsoft.com/default.aspx/kb/312629/EN-US/?p=1
ÔÒò£º
ÄǸö Response.End ·½·¨½áÊøÒ³µÄÖ´ÐУ¬²¢×ªÒƵ½Ö´ÐÐ µÄApplic ......
ASP.NETÒ³ÃæÓëIISµ×²ã½»»¥ºÍ¹¤×÷ÔÀíÏê½â
µÚÒ»»Ø£º
ÒýÑÔ
ÎÒ²éÔĹý²»ÉÙAsp.NetµÄÊé¼®£¬·¢ÏÖ´ó¶àÊý×÷Õß¶¼ÊÇÕ¾ÔÚÒ»¸ö±È½Ï¸ßµÄ²ã´ÎÉϽ²½âAsp.Net¡£ËûÃÇÄÍÐÄ¡¢Ï¸ÖµظæËßÄãÈçºÎÒ»²½²½ÍϷſؼþ¡¢ÉèÖÿؼþÊôÐÔ¡¢±àдCodeBehind´úÂ룬ÒÔʵÏÖij¸öÌØ¶¨µÄ¹¦ÄÜ¡£
ÕâÖÖ×ö·¨£¬Êµ¼ÊÉÏÊǻشðÁË“ÈçºÎÈ¥×ö”µÄÎÊÌ⣬ȴà ......
´ÓÊý¾Ý¿âÈ¡³öÊý¾ÝÈ»ºó¶¯Ì¬µÄÉú³Éhtml¾²Ì¬Ò³Ãæ¡£ÕâÖÖ¼¼ÊõÌØ±ðÊÇÔÚÓµÓдóÁ¿Ò³ÃæµÄÍøÕ¾ÖÐÏÔµÄÌØ±ðµÄÖØÒª
¾ßÌå²½ÖèÎÒÏêϸµÄдһÏÂ
1.½¨Á¢¾²Ì¬Ä£°åÒ³Ãæ¡£Ò²¾ÍÊǽ¨Á¢ÆðÄ£°åÒ³ÃæµÄ¼Ü¹¹
2.È»ºó´Óºǫ́Êý¾Ý¿âÖÐÌáÈ¡ÄÚÈÝ£¬½øÐÐÌæ»»
3.°ÑÌæ»»ºóµÄ×Ö·û´®Ð´ÈëÖÐ
ÎÒÒ²°´ÕÕÉÏÃæµÄ˳Ðò×öһϰÉ
Ê×ÏȽ¨Á¢Ò»¸öÄ£°åHtmlÈ¡ÃûModelHtml.htm. ......