The Aloaha NNTP 2 Web interface is a a script example based on the Aloaha NNTP SDK.
This script example demonstrates how easy it is to map your NNTP News Groups to a ASP based Website.
The script furthermore "understands" some parameter such as:
ngroup: the newsgroup you want to display nserver: the servername the newsgroup is hosted nid: the message number or ID you want to display
Below you find the source code of this script. Just copy&paste it into your asp page.
<% @Language = "VBScript" %>
<%
on error resume next
Response.buffer = false
Response.Expires = -1
Server.ScriptTimeout = 600
%> <html>
<head> <% On Error Resume Next
'declare objects
dim news
dim nbody
dim hbody
dim nheader
dim nsubject
dim problem
dim lnews
problem = 0
'create object
err.clear
Set news=CreateObject("pop3news.popnews") if err.number=0 then
'Set server and port
news.remotehost="news.microsoft.com"
if instr(Request.QueryString("NSERVER"),".")> 0 then
news.remotehost=Request.QueryString("NSERVER")
end if
if instr(Request.QueryString("nserver"),".")> 0 then
news.remotehost=Request.QueryString("nserver")
end if
news.remoteport="119" 'choose newsgroup
dummy=news.enter_group("microsoft.public.exchange2000.general")
if instr(Request.QueryString("NGROUP"),".")> 0 then
dummy=news.enter_group(Request.QueryString("NGROUP"))
end if
if instr(Request.QueryString("ngroup"),".")> 0 then
dummy=news.enter_group(Request.QueryString("ngroup"))
end if
lnews=""
lnews=trim(cstr(Request.QueryString("NID")))
if lnews="" then
lnews=trim(cstr(Request.QueryString("nid")))
end if if lnews="" then
lnews=CStr(news.lastnews)
else
lnews=trim(cstr(Request.QueryString("NID")))
if instr(lnews,"@")>0 then
if right(lnews,1)<>">" then lnews=lnews&">"
if left(lnews,1)<>"<" then lnews="<"&lnews
end if
end if 'prepare website nsubject = news.get_article_as_CDO(cstr(lnews)).subject
if nsubject="" then nsubject = "Aloaha NNTP SDK"
nheader = "<p align='left'></strong>"&news.get_newsheader(cstr(lnews))&"<BR><BR>"
nheader = replace(nheader,vbcrlf,"<br>")
nheader = replace(nheader,vbcr,"<br>")
nheader = replace(nheader,vblf,"<br>") nbody = news.get_article_as_CDO(cstr(lnews)).textbody
hbody = news.get_article_as_CDO(cstr(lnews)).htmlbody if len(hbody)>len(nbody) then
nbody=hbody
else
nbody = replace(nbody,vbcrlf,"<br>")
nbody = replace(nbody,vbcr,"<br>")
nbody = replace(nbody,vblf,"<br>")
end if
else
problem = 1
end if %> <title><% response.write nsubject %></title>
</head>
<body> <% if problen = 0 then response.write nsubject
response.write "<BR><BR>"
response.write nbody
response.write "<BR><BR>"
response.write nheader else
response.write "<BR><CENTER>Problems loading the NNTP Object</CENTER><BR>"
end if
%> </body>
</html> <%
On Error Resume Next 'destroy Object
Set news=Nothing
%>
Please note that the Aloaha SDKs are very powerfull and impossible to show everything on a simple website.