views:

517

answers:

1

i put this in Global.asax.cs

routes.MapWebFormRoute("Page", "Page/{*anything}", "~/Page.aspx", false);

how i can get value of {*anything} in Page.aspx

i'm using WebFormRouting from codeplex

+2  A: 

For WebFormRouting, you should check out this blog post by Phil Haack:

Using Routing With WebForms
http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx

He says that, If your Web Form Page implements the IRouteable interface, the WebFromRouteHandler class can pass it the RequestContext. Once this is done, you should still be able to do

string value = Page.RouteData.Values("anything");

or something similar. There is a sample project at the blog post.

Robert Harvey
i'm using webform, not mvc, i need to get this value in Page_Load of Page.aspx
complez