singlefile.aspx

来自「Code for VB.NET教程源码 很好的源码」· ASPX 代码 · 共 49 行

ASPX
49
字号
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>

<Script language="VB" runat="server">
Public Sub Page_Load(sender As Object, e As EventArgs)
  Dim dom As XmlDocument
  Dim xsl As New XslTransform()

  ' Do we have the Wrox Pro ASP.NET book in the Cache?
  If (IsNothing(Cache("1861004885.xml"))) Then
    CacheStatus.Text = "Item not present, updating the Cache..."
    UpdateCache("1861004885.xml")
  Else
    CacheStatus.Text = "Retrieving from Cache"
  End If

  ' Load the transform
  xsl.Load(Server.MapPath("book.xsl"))

  dom = CType(Cache("1861004885.xml"), XmlDocument)

  BookDisplay.Document = dom
  BookDisplay.Transform = xsl

End Sub

Public Sub UpdateCache(strItem As String)

    Dim strPath As String
    Dim dom As New XmlDocument()

    ' Determine the file path the the file to monitor
    strPath = Server.MapPath(strItem)

    ' Load the file into an Xml Dom
    dom.Load(strPath)

    ' Create a CacheDependency on the file
    Dim dependency as new CacheDependency(strPath)

    ' Cache the XML document
    Cache.Insert(strItem, dom, dependency)

End Sub
</Script>
Status: <asp:label id="CacheStatus" runat=server/>
<br>
<asp:xml id="BookDisplay" runat=server/>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?