推薦:ASP 3.0高級(jí)編程(四十三)9.3.5 數(shù)據(jù)高速緩存首先需要注意的是,數(shù)據(jù)高速緩存與記錄集高速緩存雖然都用于改善性能,但兩者是無關(guān)的。數(shù)據(jù)高速緩存是臨時(shí)的數(shù)據(jù)存儲(chǔ)區(qū),允許使用高速緩存中的數(shù)據(jù),而不是重新生成新的數(shù)
ASP Response 對(duì)象用于從服務(wù)器向用戶發(fā)送輸出的結(jié)果。
實(shí)例
使用ASP寫文本
本例演示如何使用ASP來寫文本。
以下為引用的內(nèi)容: <html> <body> <% response.write("Hello World!") %> </body> </html> |
在ASP中使用HTML標(biāo)簽格式化文本
本例演示如何使用ASP將文本和HTML標(biāo)簽結(jié)合起來。
以下為引用的內(nèi)容: <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
本例演示如何將用戶重定向至另一個(gè)的URL。
以下為引用的內(nèi)容: <% |
顯示隨機(jī)的鏈接
本例演示一個(gè)超級(jí)鏈接,當(dāng)您每次載入頁面時(shí),它將顯示兩個(gè)鏈接中的其中一個(gè)。
以下為引用的內(nèi)容: <html> |
控制緩存
本例演示如何控制緩存。
以下為引用的內(nèi)容: <% |
清空緩存
本例演示如何清空緩存。
以下為引用的內(nèi)容: <% 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> |
在處理過程中終止腳本并返回結(jié)果
本例演示如何在處理過程中中斷腳本的運(yùn)行。
以下為引用的內(nèi)容: <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> |
設(shè)置在頁面失效前把頁面在瀏覽器中緩存多少分鐘
本例演示如何規(guī)定頁面在失效前在瀏覽器中的緩存時(shí)間。
以下為引用的內(nèi)容: <%Response.Expires=-1%> <html> <body> <p>This page will be refreshed with each access!</p> </body> </html> |
設(shè)置頁面緩存在瀏覽器中的失效日期或時(shí)間
本例演示如何規(guī)定頁面在瀏覽器中的緩存時(shí)間日期或時(shí)間
以下為引用的內(nèi)容: <% 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> |
檢查用戶是否仍然與服務(wù)器相連
本例演示如何檢查用戶是否已與服務(wù)器斷開。
以下為引用的內(nèi)容: <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> |
設(shè)置內(nèi)容類型
本例演示如何規(guī)定內(nèi)容的類型。
以下為引用的內(nèi)容: <% Response.ContentType="text/html" %> <html> <body> <p>This is some text</p> </body> </html> |
設(shè)置字符集
本例演示如何規(guī)定字符集的名稱。
以下為引用的內(nèi)容: <% Response.Charset="ISO8859-1" %> <html> <body> <p>This is some text</p> </body> </html> |
Response 對(duì)象
ASP Response 對(duì)象用于從服務(wù)器向用戶發(fā)送輸出的結(jié)果。它的集、屬性和方法如下:
分享:用好ASP.NET 2.0的URL映射簡介: URL映射是ASP.NET 2.0中提供的新特性。URL映射技術(shù)幫助我們將一個(gè)特定URL映射為另一個(gè)URL。為了幫助理解,我們假設(shè)你在站點(diǎn)有一個(gè)叫Homepage.aspx的頁面來訪問主頁,所有的用戶也都用
新聞熱點(diǎn)
疑難解答
圖片精選