Questions tagged [iroutehandler]
16 questions
5
votes
3 answers
Session is null in IRouteHandler.GetHttpHandler with Asp.net routing
I'm trying to get Session enabled in the GettHttpHandler method of my IRouteHandler classes but session is always null. Could someone tell me what I'm doing wrong?
In global.asax I have
RouteTable.Routes.Add("All", new Route("{*page}", new…

Mathias Rönnlund
- 4,078
- 7
- 43
- 96
4
votes
3 answers
How to Make ASP.NET MVC Recognize IHttpAsyncHandler from IRouteHandler.GetHttpHandler()?
In this question & answer, I found one way to make ASP.NET MVC support asynchronous processing. However, I cannot make it work.
Basically, the idea is to create a new implementation of IRouteHandler which has only one method GetHttpHandler. The…

Morgan Cheng
- 73,950
- 66
- 171
- 230
4
votes
1 answer
Route gets mapped to parameters of different route
I’m trying to set up some routes for my ASP.NET MVC 5 project.
I defined custom routes to get nice blog post permalinks – those
seem to be working fine
I added a XmlRpc Handler (similar to how it’s done
in Mads' Miniblog and Scott’s post)
Now I…

marce
- 781
- 1
- 10
- 20
4
votes
1 answer
How to redirect user to another Url from MVC Custom Router Handler?
I am working with CustomMvcRouterHandler, Based on some logic I just want to redirect user to another Url from CustomHandler.
public class CustomMvcRouterHandler : IRouteHandler
{
public IHttpHandler GetHttpHandler(RequestContext…

Shubhajyoti Ghosh
- 1,292
- 5
- 27
- 45
3
votes
1 answer
ASP.NET MVC 2.0 + Implementation of a IRouteHandler does not fire
Can anybody please help me with this as I have no idea why
public IHttpHandler GetHttpHandler(RequestContext requestContext)
is not executing. In my Global.asax.cs I have
public class MvcApplication : System.Web.HttpApplication
{
public static…

Peter
- 227
- 2
- 7
2
votes
2 answers
IRouteHandler in Web Forms: Routing requests that require HttpContext.User
I'm trying to add a pretty basic route to an Asp.Net Web Forms app (running under IIS 7, integrated mode): for requests coming to http://mydomain.com/foo/ I would like to show the results of a dynamic page (http://mydomain.com/foopage.aspx).
I've…

neuracnu
- 119
- 3
- 7
1
vote
1 answer
Only Serve Static Files From a Specific Directory via Code
I am looking for a code based solution to only serving static files from a specified directory using ASP.NET routing rather than specify a HttpHandler in the Web.config.
For example:
I have the following partial directory…

Tom Bell
- 1,120
- 2
- 16
- 33
1
vote
2 answers
Custom IRouteHandler route screws up MVC link building
I have a custom routehandler in ASP.NET MVC2 to catch all url's at a prefixed path like this:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.Add(new Route("@api/{*all}", new ApiHandler()));
routes.MapRoute(
"Default", // Route name
…

Arne Claassen
- 14,088
- 5
- 67
- 106
1
vote
1 answer
Why not into RouteHandler ?
I'm trying write a demo about "Prevent Image Leeching",
Reference resources: http://www.mikesdotnetting.com/article/126/asp-net-mvc-prevent-image-leeching-with-a-custom-routehandler
but when I using
, The…


qingyun1029
- 45
- 1
- 9
1
vote
1 answer
Protecting images in ASP.NET MVC (w/ custom RouteHandler)
I created a custom RouteHandler for images that I want protected. My RouteHandler simply takes a new route (graphics/{filename}) and does a lookup for the true file path, sets the mime type, and serves it up. That works fine.…

Brian David Berman
- 7,514
- 26
- 77
- 144
0
votes
1 answer
Custom ASP.NET callback-based routing; dynamic ASPX page instantiation and rendering
I'm working on a small school project, an ASP.NET C# website; we're working with a Web Application, using a Global.asax file to centralize request logic.
Anyway, my colleague and I are responsible for the coding in our group, and we both come as…

Dan Lugg
- 20,192
- 19
- 110
- 174
0
votes
1 answer
Convert ASP.NET MVC MvcRouteHandler to ASP.NET Core MVC
I have to port over the following ASP.NET MVC code to .NET Core and I'm stuck on how to do this.
This is my old ASP.NET MVC code:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
…

zSynopsis
- 4,854
- 21
- 69
- 106
0
votes
1 answer
Web Forms - Session object is null when going through custom IRouteHandler
I'm having an issue in ASP WebForms where HttpContext.Current.Session is null if my request goes through a custom IRouteHandler.
I have seen many answers where people are giving advices on how to access the Session object inside a custom…

LaCartouche
- 121
- 1
- 11
0
votes
1 answer
IRouteHandler not routing through RouteConfig
I have a IRouteHander class which I use to resize images on the fly and add expire headers to them, Recently I moved to MVC5 and now updating my code. I tried to register the same route for that class in RouteConfig.cs
routes.Add(new…

aadi1295
- 982
- 3
- 19
- 47
0
votes
0 answers
c# Web Application loses user context when using custom routing
I am building a non-mvc website using C# and ASP.NET 3.5. I have custom routes working well, and have done the same on other sites. I also have forms authentication working well and have used forms authentication on other sites, but never both at…

jleger
- 1
- 1