Author: ASP.NET 4.0 | Posted on: 5/19/2009 1:23:41 PM | Views : 762

When we were adding WebForm routing to ASP.NET 4 Beta 1, we didn?t have a chance to add in a couple of methods which make working with Routes and Web Forms a lot easier! Note: the code below is ?similar? to that which we?re adding ASP.NET 4 Beta 2, *that* code will be of much higher quality however, this is a sample only! 1: using System; 2: using System.Collections.Generic; 3: using System.Linq; 4: using System.Web; 5: using System.Web.Routing; 6: 7: public static class RouteExtensions 8: { 9: public static string GetUrlForRoute( this System.Web.UI.Page page, string routeName, RouteValueDictionary parameters) 10: { 11: VirtualPathData vpd= RouteTable.Routes.GetVirtualPath( null , routeName, parameters); 12: return vpd.VirtualPath; 13: } 14...(read more) ...

Go to the complete details ...