Skip to content

Instantly share code, notes, and snippets.

@donma
Created February 18, 2025 04:26
Show Gist options
  • Select an option

  • Save donma/4b1284a8b3092c8bd59d3a3e0ca51d36 to your computer and use it in GitHub Desktop.

Select an option

Save donma/4b1284a8b3092c8bd59d3a3e0ca51d36 to your computer and use it in GitHub Desktop.
//add using
using System.Web.Routing;
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routeCollection)
{
// product/product_id
routeCollection.MapPageRoute("PRODUCT", "product/{id}", "~/product.aspx", false, null,
new RouteValueDictionary { { "id", ".*?" } });
// product/product_id/product_desc
routeCollection.MapPageRoute("PRODUCT_DESC", "product/{id}/{desc}", "~/product.aspx", false, null,
new RouteValueDictionary { { "id", ".*?" } });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment