Routing for Web Forms in ASP.NET 4.0

A while back on a lark, I posted a prototype demonstrating how one could use Routing within Web Forms. This is something you can do today with ASP.NET 3.5 SP1, because of the work we did to separate Routing from ASP.NET MVC. I would have liked to include Web Form Routing as part of the Routing feature when we were working on SP1, but we didn’t have the time to do so in a robust manner before SP1 was locked down.

Since then, Scott Galloway, who just happens to be my office mate, has taken the reigns and is the PM in change of guiding the Web Form Routing feature to be included in ASP.NET 4.0 in a more integrated fashion.

He wrote a blog post earlier today describing some of the ways that routing will be more deeply integrated into ASP.NET such as new properties of the Page class, cool uses of Expression Builders, etc… That’s just a teaser as he promises to go a little more in depth soon.

Technorati Tags: ,

What others have said

Requesting Gravatar... q Jan 26, 2009 4:11 AM
# re: Routing for Web Forms in ASP.NET 4.0
we want mvc!
we want mvc!!
we want mvc!!!
Requesting Gravatar... Phil Jan 26, 2009 5:29 AM
# re: Routing for Web Forms in ASP.NET 4.0
I want my, I want my, I want my MVC....

Requesting Gravatar... Alper Jan 26, 2009 7:12 AM
# re: Routing for Web Forms in ASP.NET 4.0
Hi Phil,

I would like to get your opinion on moving from Web forms to MVC using a step by step strategy.

In an existing web form project
* Disable Viewstate
* Reduce or eliminate Postbacks
* Reduce or eliminate web controls with html controls
* Implement Routing

It's kinda like preparing your existing application or a writing a new ASP.NET 2.0 application for a smooth migration to MVC eventually.

What are some of the other factors that would make the move from Web form to MVC as smooth as possible?

Thanks.
Requesting Gravatar... mike johnson Jan 26, 2009 9:14 AM
# re: Routing for Web Forms in ASP.NET 4.0
I had always hoped for a hybrid of MVC, webforms. there are things in LOB applications that are data entry intensive that you just dont see in public facing web applications that I dont think are there yet. ie. selecting a state/province and it updates the available set of area codes in telephone number input boxes to choose most likely first.

I know that MVC can do this but it doesnt fall in the realm of easy or productive. But ehwere mvc make sense I can see the appeal.
Requesting Gravatar... Mike Jan 26, 2009 2:38 PM
# re: Routing for Web Forms in ASP.NET 4.0
What's webforms?

Just kidding. I can see a lot of good use for it, especially in new and existing CMS systems.
Requesting Gravatar... Andrei Rinea Jan 26, 2009 3:48 PM
# re: Routing for Web Forms in ASP.NET 4.0
Most Violent Crime :P

I mean Model - View - Controller :))

When will the ASP.NET MVC be released? :(
Requesting Gravatar... Tyler Garlick Jan 26, 2009 9:46 PM
# re: Routing for Web Forms in ASP.NET 4.0
What about abstracting out the application_start routing data into web.config parameters--I'd like to see it go declarative.

I could totally see something like this:

<web.routing>
<route pattern="{controller}{action}{id}" handler="WebFormRouteHandler" />
</web.routing>
Requesting Gravatar... Richard Kimber Feb 01, 2009 2:32 PM
# re: Routing for Web Forms in ASP.NET 4.0
Hi,

Based on your original post, I implemented routing using web forms on iis6 (.net 3.5 sp1) on High Point Village.

I'm looking forward to having an easier time of it on iis7.

Rich

Requesting Gravatar... Criação de Site Aug 04, 2010 9:20 PM
# re: Routing for Web Forms in ASP.NET 4.0
is possible to mix 2 applications in same domain using routing ?
like this: www.site.com/app2/* points to application 2
and: www.site.com/* points to other application

What do you have to say?

(will show your gravatar)
Please add 4 and 2 and type the answer here: