Wednesday, March 30, 2011

Routing in ASP.NET WebForms

http://www.west-wind.com/weblog/posts/974489.aspx

protected void Application_Start(object sender, EventArgs e)
{
    RegisterRoutes(RouteTable.Routes);
}

void RegisterRoutes(RouteCollection routes)
{
    routes.MapPageRoute("StockQuote", "StockQuote/{symbol}", "StockQuote.aspx");
");
}
public partial class StockQuote1 : System.Web.UI.Page
{
    protected StockQuote Quote = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        string symbol = RouteData.Values["symbol"] as string;
    }
}

No comments:

Post a Comment