Remember before? I used to write a widget on the page to call the specified content (RSS output address). The best way is to output the string through XSLT+XML. Let us take a minute to recall the previous approach
:
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
Dim CacheKey As String = Url & "-" & Sort
Dim objCache As System.Web.Caching.Cache = HttpRuntime.Cache
If objCache.Item(CacheKey) Is Nothing Then
Dim xpDocument As XPathDocument = New XPathDocument(Url, XmlSpace.Preserve)
Dim XTran As XslTransform = New XslTransform
XTran.Load(Web.HttpRuntime.AppDomainAppPath & "TransForm.xsl") 'TransForm.xsl
Dim sw As StringWriter = New StringWriter
Dim xArgList As XsltArgumentList = New XsltArgumentList
xArgList.AddParam("Sort", "", Sort)
xArgList.AddParam("strlength", "", strLength)
XTran.Transform(xpDocument, xArgList, sw)
objCache.Insert(CacheKey, sw, Nothing, DateTime.Now.AddMinutes(15), TimeSpan.Zero)
End If
MyBase.Text = CType(objCache.Item(CacheKey), StringWriter).ToString
End SubXSLT conversion file
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl=" http://www.w3.org/1999/XSL/Transform "
xmlns=" http://www.w3.org/TR/REC-html40 "
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:dc=" http://purl.org/dc/elements/1.1/ "
xmlns:slash=" http://purl.org/rss/1.0/modules/slash/ "
xmlns:sy=" http://purl.org/rss/1.0/modules/syndication/ "
xmlns:resuls="urn:StrLength">
<xsl:param name="Sort" select="'10'"></xsl:param>
<xsl:param name="strlength" select="'15'"></xsl:param>
<xsl:template match="//rss">
<xsl:apply-templates select="channel" />
</xsl:template>
<msxsl:script language="VB" implements-prefix="resuls">
<![CDATA[
Function GetSubString(byval origStr As String, byval endIndex As Integer) As String
Dim bytes As Byte() = System.Text.Encoding.GetEncoding("gb2312").GetBytes(origStr)
If endIndex >= bytes.Length Then
Return origStr
End If
Dim subBytes(endIndex) As Byte
Array.Copy(bytes, 0, subBytes, 0, endIndex)
Return System.Text.Encoding.GetEncoding("gb2312").GetString(subBytes) + ""
End Function 'GetSubString
public function strDate(byval s as string)as string
return CDate(s).Day.ToString & "Day"
end function
]]>
</msxsl:script>
<xsl:template match="channel">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<xsl:for-each select="item">
<xsl:if test="position() <=$Sort">
<tr>
<td width="21"><img src=" http://rss.msnbc.msn.com/id/3032091/device/rss/rss.xml)
Bind according to the format of RSS output
OK. You can now browse the effects
When going out for dinner in the evening. Step outside and feel summer coming. Oh. I love this feeling of summer. Take a good mood and go out for a walk. It’s also a great treat. at last. Recommend a song: The taste of summer.