I need map HttpHandler on Handler.xml.
I wrote to web.config
I also try map IIS, Home direcortory to .xml and still write Page can't load.
Thanks for help and ideas.
Tomas
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Roei BarRank #1,271 · 1.4K reputationPosted Aug 6, 2009, 3:23 AM EDT
on web config add this:
and here is the Handler
using System;
namespace Foo
{
public class Redirector : System.Web.IHttpHandler
{
void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext context)
{
string userAgent = context.Request.UserAgent;
if (userAgent != null && userAgent.Length > 0)
{
// If they aren't FeedBurner (optional example check)
if (userAgent.StartsWith("FeedBurner") == false)
{
string redirect = String.Empty;
string physicalpath = System.IO.Path.GetFileName(context.Request.PhysicalPath).ToUpperInvariant();
switch (physicalpath)
{
case "BAR.XML":
redirect = "http://feeds.feedburner.com/Bar";
break;
case "FOO.XML":
redirect = "http://feeds.feedburner.com/Foo";
break;
}
if (redirect != String.Empty)
{
context.Response.Redirect(redirect); //temporary redirect
//context.Response.StatusCode =(int) System.Net.HttpStatusCode.MovedPermanently; //permanent HTTP 301
//context.Response.Status = "301 Moved Permanently";
//context.Response.RedirectLocation = redirect;
return;
}
}
}
context.Response.ContentType = "application/xml";
context.Response.TransmitFile(context.Request.PhysicalPath);
}
bool System.Web.IHttpHandler.IsReusable
{
get { return true; }
}
}
}
}
}