Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net routing in webform - how get route data

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

like image 592
complez Avatar asked Feb 28 '23 07:02

complez


1 Answers

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 be able to:

string value = Page.RouteData.Values["anything"]; 

There is a sample project at the blog post.

like image 100
Robert Harvey Avatar answered Mar 06 '23 15:03

Robert Harvey