%@ WebHandler Language="CS" Class="wikiHandler" %>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using ScrewTurn.Wiki.PluginFramework;
using System.Text;
public class wikiHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try {
string output;
if(context.Request.Params["Page"] != null){
string pagename;
pagename = context.Request.Params["Page"];
output = PrintContent(pagename);
}
else
{
output = "Page Not Found";
}
output = "
" + output + "
";
context.Response.ContentType = "text/html";
context.Response.Write(output);
}
catch (Exception ex) {
context.Response.Write(ex);
}
}
public string PrintContent(string pageName) {
PageInfo page = null;
PageContent content = null;
page = ScrewTurn.Wiki.Pages.Instance.FindPage(pageName);
if (page != null){
content = ScrewTurn.Wiki.Content.GetPageContent(page, true);
StringBuilder sb = new StringBuilder();
sb.Append(@"" + content.Title + "
");
sb.Append(ScrewTurn.Wiki.Content.GetFormattedPageContent(page, true));
return sb.ToString();
}
else
{
return "Page not Found";
}
}
public bool IsReusable {
get { return true; }
}
}