How to Access GetRouteUrl in .ashx IHttpHandler's
For a while I wasn't sure how to access GetRouteUrl from an .ashx IHttpHandler page. I wanted to access route url's setup in the Global.asax file to be used in files like rss.ashx, instead of having to hard codes the page URL's in my .ashx pages. Well, this routing problem isn't so difficult once you know how to do it. To access and use GetRouteUrl in an .ashx follow this simple example:
string url = new System.Web.UI.Control().GetRouteUrl("ArticleStory", new { pathname = pathName });
It's as simple as that...! You'll just need to change the routeName, and object parameters to your specific Route.
Also if you need to get fully qualified URL's see: How to Get Fully Qualified Route Urls from GetRouteUrl