網路城邦
上一篇 回創作列表 下一篇   字體:
Create RSS
2013/07/08 10:24:02瀏覽183|回應0|推薦0

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%


        string mdir;
 //     mdir = "c:/inetpub/wwwroot/lib/javascript/";
     mdir = "c:/inetpub/wwwroot/lib/"+ Request["Dir"]+"/";
       
     System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(mdir);
  
        Response.Clear();
        Response.ContentType = "text/xml";
        System.Xml.XmlTextWriter xtwFeed = new System.Xml.XmlTextWriter(Response.OutputStream, Encoding.UTF8);
        xtwFeed.WriteStartDocument();

        // The mandatory rss tag

        xtwFeed.WriteStartElement("rss");
        xtwFeed.WriteAttributeString("version", "2.0");
        xtwFeed.WriteStartElement("channel");
        xtwFeed.WriteElementString("title", "Hello word(" + Request["Dir"]+")");
        xtwFeed.WriteElementString("link", "http://localhost/default.aspx");
        xtwFeed.WriteElementString("description", mdir);
  //    xtwFeed.WriteElementString("copyright", "Copyright 2013 - 2018  All rights reserved.");

     foreach (System.IO.FileInfo fi in di.GetFiles())
     {
            xtwFeed.WriteStartElement("item");
            xtwFeed.WriteElementString("title", fi.Name);
            xtwFeed.WriteElementString("description", "description" );
            xtwFeed.WriteElementString("link", "http://localhost/Lib/" + Request["Dir"]+"/" + fi.Name);
            xtwFeed.WriteElementString("pubDate", "pubDate" );
            xtwFeed.WriteEndElement();
     }

        // Close all tags
        xtwFeed.WriteEndElement();
        xtwFeed.WriteEndElement();
        xtwFeed.WriteEndDocument();
        xtwFeed.Flush();
        xtwFeed.Close();
        Response.End();


%>
<script  type="text/javascript" runat="server"  >
   
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="ttt">
    fghgh
    </div>
    </form>
</body>
</html>

( 知識學習科學百科 )
回應 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=ezkang3245&aid=7899391