routes.MapPageRoute("product-search", "albums/search/{term}", "~/aspx/AlbumSearch.aspx"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults );
@Html.RouteLink("test", "product-search", new { term = "" })
public partial class AlbumSearch : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string term = RouteData.Values["term"].ToString(); //Response.Write("fjdslajfdlsjaflsafjsjflaf"); Response.Write("<h1>" + term + "</h1>"); } }
or
<asp:Label ID=”Label1” runat=”server” Text=”<%$RouteValue:Term%>” />