Debug Attribute Routing in ASP.NET - asp.net-mvc

The AttributeRouting package contains a handler called LogRoutesHandler that "emits the routes in the RouteTable to a browser".
Is there something similar in the new MVC5 attribute routing functionality?

I also miss the routes.axd feature of AttributeRouting in ASP MVC 5. I am using currently using Glimpse to debug routes. It's not quite the same, far from friendly compared to routes.axd, but it helps.

Related

add an ASP.NET MVC project to an existing ASP.NET Web forms application

How to add an ASP.NET MVC project to an existing ASP.NET Web forms application. How to call MVC project page from existing website.
You can refer this step-by-step guide on how to do that.
Your question is similar to
Is it possible to host an asp.net MVC in the same folder as asp.net web forms app?
We were in the exact same situation as you and it's not as bad as you might think. Thanks to Nuget it's a fairly easy process that you can follow and Dave Paquette describes how to do it in his blog post
And once you've got Mvc up and running all you need to do to go from one to the other is to redirect to Mvc from webforms:
Response.Redirect("~/Controller/Action/")
You can also use the Mvc routing system to generate routes from within webforms as well:
System.Web.Mvc.UrlHelper url = new System.Web.Mvc.UrlHelper(HttpContexxt.Current.Request.requestContext)
Response.Redirect(url.Action("Action", "Controller"))

How do you get the area of the current request when using MVC 2 RC?

I was using MVC 1.0 RTM, and the Haack solution for Areas
I just recently moved to MVC2 RC and I'm using single project areas with my controllers in separate assemblies. My problem is that in the MVC 1 solution I ALWAYS had "area" in my RouteData.Values collection, in MVC2 RC it doesn't exist. Do you know how to get this in MVC2 RC?
Thanks in advance!
This is kept in a DataToken for the route. Namely, route.DataTokens["area"]. Look at AreaHelpers.cs in the MVC source for details.
By the way, when you ask a question like this, you should show the code you're using which is not working. It makes it much easier to supply an answer. Right now, I don't know if you've already tried the method above, but are making an error with it, or if you haven't discovered this yet.

wildcards in asp.net mvc routes

i'm using asp.net mvc with vs2008 and IIS7.
What i want to accomplish is that all requests that START WITH 'summer' are routed to the same controller.
'till now i've built tons of routes, but they were all for one path (with parameters offcourse) but this one must route:
www.mysite.com/summercity
www.mysite.com/summermadness
www.mysite.com/summer
www.mysite.com/summerweather
to the same controller.
the only solution i've come up with is 'summer*', but that didn't work :)
Michel
You can use:
/Summer{*Data}

ASP.NET MVC Routing issues

Is there any tools or utilities to help in debugging ASP.NET MVC Routing issues?
Phil Haack, one of the creators of ASP.Net MVC, put together a route debugger. You can get it (with full source code) here.
Glimpse also has a plugin for route debugging.

Trying to make Weborb .NET work with ASP.NET MVC

We have been using weborb for .net on an existing application for some time now and it has worked very well. We decided to rewrite our application in ASP.NET MVC and now I need to make weborb work with mvc. I have been getting a 404 the resource cannot be found error while trying to connect to the weborb.aspx page. I have added all of the appropriate entries to the web.config file and I even found this article explaining how to make the two work together
http://aspzone.com/tech/how-to-get-weborb-and-asp-net-mvc-to-work-together/
But to no avail. I can't make it work. Thanks.
If 404 is given then there is no such resource. Most likely the MVC tries to route the request and cannot find appropriate one.
Try to add ignore route in the beginning of routes registration. Something like this:
routes.IgnoreRoute("weborb.aspx/{*pathInfo}");
My problem was that I had the project set up incorrectly as a website and not an mvc application. Once I did that the route explained the blog post I referenced worked like a charm.

Resources