推薦:ASP 3.0高級編程(四十三)9.3.5 數據高速緩存首先需要注意的是,數據高速緩存與記錄集高速緩存雖然都用于改善性能,但兩者是無關的。數據高速緩存是臨時的數據存儲區,允許使用高速緩存中的數據,而不是重新生成新的數
ASP Response 對象用于從服務器向用戶發送輸出的結果。
實例
使用ASP寫文本
本例演示如何使用ASP來寫文本。
以下為引用的內容: <html> <body> <% response.write("Hello World!") %> </body> </html> |
在ASP中使用HTML標簽格式化文本
本例演示如何使用ASP將文本和HTML標簽結合起來。
以下為引用的內容: <html> <body> <% response.write("<h2>You can use HTML tags to format the text!</h2>") %> <% response.write("<p style='color:#0000ff'>This text is styled with the style attribute!</p>") %> </body> </html> |
將用戶重定向至不同的URL
本例演示如何將用戶重定向至另一個的URL。
以下為引用的內容: <% |
顯示隨機的鏈接
本例演示一個超級鏈接,當您每次載入頁面時,它將顯示兩個鏈接中的其中一個。
以下為引用的內容: <html> |
控制緩存
本例演示如何控制緩存。
以下為引用的內容: <% |
清空緩存
本例演示如何清空緩存。
以下為引用的內容: <% Response.Buffer=true %> <html> <body> <p>This is some text I want to send to the user.</p> <p>No, I changed my mind. I want to clear the text.</p> <% Response.Clear %> </body> </html> |
在處理過程中終止腳本并返回結果
本例演示如何在處理過程中中斷腳本的運行。
以下為引用的內容: <html> <body> <p>I am writing some text. This text will never be<br> <% Response.End %> finished! It's too late to write more!</p> </body> </html> |
設置在頁面失效前把頁面在瀏覽器中緩存多少分鐘
本例演示如何規定頁面在失效前在瀏覽器中的緩存時間。
以下為引用的內容: <%Response.Expires=-1%> <html> <body> <p>This page will be refreshed with each access!</p> </body> </html> |
設置頁面緩存在瀏覽器中的失效日期或時間
本例演示如何規定頁面在瀏覽器中的緩存時間日期或時間
以下為引用的內容: <% Response.ExpiresAbsolute=#May 05,2001 05:30:30# %> <html> <body> <p>This page will expire on May 05, 2001 05:30:30!</p> </body> </html> |
檢查用戶是否仍然與服務器相連
本例演示如何檢查用戶是否已與服務器斷開。
以下為引用的內容: <html> <body> <% If Response.IsClientConnected=true then Response.Write("The user is still connected!") else Response.Write("The user is not connected!") end if %> </body> </html> |
設置內容類型
本例演示如何規定內容的類型。
以下為引用的內容: <% Response.ContentType="text/html" %> <html> <body> <p>This is some text</p> </body> </html> |
設置字符集
本例演示如何規定字符集的名稱。
以下為引用的內容: <% Response.Charset="ISO8859-1" %> <html> <body> <p>This is some text</p> </body> </html> |
Response 對象
ASP Response 對象用于從服務器向用戶發送輸出的結果。它的集、屬性和方法如下:
分享:用好ASP.NET 2.0的URL映射簡介: URL映射是ASP.NET 2.0中提供的新特性。URL映射技術幫助我們將一個特定URL映射為另一個URL。為了幫助理解,我們假設你在站點有一個叫Homepage.aspx的頁面來訪問主頁,所有的用戶也都用
新聞熱點
疑難解答