用ASP.NET建立簡單的新聞發布系統

來源:互聯網
上載者:User

下面是一個建立新聞發布系統的程式,不用和資料庫打交道哦

步驟:

(1).在vs2005中建立網站,建立三個aspx網頁,分別命名:title.aspx,news.aspx,main.aspx其中title.aspx用來設定標題,可以自己設計,寫幾個字也行,news.aspx用來顯示新聞標題,main.aspx用來顯示新聞內容。

(2).建立htm頁,用來設計架構。代碼如下:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>無標題頁</title>
</head>
<frameset border="0" bordercolor="#6699cc" framespacing="3" id="fsTop" rows="85,*">
<frame frameborder="no" marginheight="0" marginwidth="0" name="title" noresize scrolling="no" src="title.aspx" >
<frameset border="0" frameborder="1" framespacing="3"  cols="110,*">
<frame frameborder="0" marginheight="0" marginwidth="0" name="dir" src="news.aspx" style="BORDER-RIGHT: #99ccff 1px solid; BORDER-TOP: #003366 1px solid" scrolling="auto" >
<frame bordercolor="#6699cc" frameborder="0" name="main" scrolling="yes" src="main.aspx?name=hello" style="BORDER-LEFT: #99ccff 2px groove; BORDER-TOP: #003366 1px solid">
</frameset>
</frameset>
</html>

(3).現在你的程式還沒有內容,建立xml檔案,命名contents.xml,用來顯示新聞標題,代碼如下:

<?xml version="1.0" encoding="GB2312"?>
<topiclist type="Dreamsite News">
<topic>
<title>歡迎進入千裡之外的新聞網!</title>
<href>main.aspx?name=hello</href>
</topic>
<topic>
<title>測試新聞</title>
<href>main.aspx?name=test</href>
</topic>
<topic>
<title> 第一條新聞</title>
<href>main.aspx?name=first</href>
</topic>
<topic>
<title> 第二條新聞</title>
<href>main.aspx?name=dddd</href>

</topiclist>注意我們的每條新聞內容都是一個xml檔案,現在你知道該做什麼了吧,建立hello.xml;test.xml;first.xml;dddd.xml檔案,在這裡給出一個例子,代碼如下:

<?xml version="1.0" encoding="GB2312"?>
<document>
<title>今日新聞</title>
<abstract>頭版新聞</abstract>
<author>千裡之外</author>
<content>&lt;paragraph&gt;大家好&lt;/paragraph&gt;</content>
</document>現在你就可以看到效果了,下面我們看一下發布新聞的代碼,也很簡單,建立manage.aspx頁面,前台代碼:
</head>
<body>
<form id="form1" runat="server">
<div>
<p>千裡之外個人新聞發布系統</p>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.