📄 singlefile.aspx
字号:
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<Script Language="C#" runat="server">
public void Page_Load(Object sender, EventArgs e) {
XmlDocument dom;
XslTransform xsl = new XslTransform();
// Do we have the Wrox Pro ASP.NET book in the Cache?
if (Cache["1861004885.xml"] == null) {
CacheStatus.Text = "Item not present, updating the Cache...";
UpdateCache("1861004885.xml");
}
else
CacheStatus.Text = "Retrieving from Cache";
// Load the transform
xsl.Load(Server.MapPath("book.xsl"));
dom = (XmlDocument)Cache["1861004885.xml"];
BookDisplay.Document = dom;
BookDisplay.Transform = xsl;
}
public void UpdateCache(string strItem)
{
string strPath;
XmlDocument dom = 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
CacheDependency dependency = new CacheDependency(strPath);
// Cache the XML document
Cache.Insert(strItem, dom, dependency);
}
</Script>
Status: <asp:label id="CacheStatus" runat=server/>
<br>
<asp:xml id="BookDisplay" runat=server/>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -