2
我正在嘗試爲網站創建一個Temporarily Down for Site Maintenance
控股頁面。該網站是一個asp.net 4 webform
網站。如何在ASP.Net 4中創建503響應標題C#
我創建了一個offline.aspx
頁面,我將把所有流量重定向到網站關閉時。
在這個頁面上,我想送一個503響應代碼並指定該站點將重新上線的日期 - 從google here
我希望它,我可以做一些在使用信息我PageLoad
這樣的:
Response.ClearHeaders();
Response.ClearContent();
Response.StatusCode = 503;
Response.StatusDescription = "HTTP/1.1 503 Service Temporarily Unavailable";
Response.Flush();
throw new HttpException(503, "Temporarily Down For Maintenance.");
這給了我正確的狀態,但頁面上出現以下錯誤:
XML Parsing Error: not well-formed
Location: http://xyz/offline.aspx
Line Number 3, Column 2:</pre></table></table></table></table></table></font></font></font></font></font></i></i></i></i></i></b></b></b></b></b></u></u></u></u></u><p> </p><hr>
我想我錯過了一些簡單的東西,我做錯了什麼?
此外,我會使用Response.AddHeader
在503
之後添加重試標頭嗎?
編輯:我在去除東西時過度冷靜。清理所有刪除和清除內容得到以下工作:
Response.StatusCode = 503;
Response.StatusDescription = "HTTP/1.1 503 Service Temporarily Unavailable";
Response.AddHeader("Retry-After", "Sat, 12 Jan 2013 23:00:00 GMT");
Response.Flush();
謝謝。這不是答案,但是你讓我注意到,我可能會刪除顯示已經開始的數據所需的東西。這導致我回到我上面發佈的答案。 – OpenR