asp.net - Get the virtual url when using routing with webforms -
how virtual url , not webforms page name url mapped when using system.web.routing webforms.
i want url "/confirm/5" , not "confirm.aspx".
to routed url for page visiting, use request.url
, pavel notes.
if need routed url different page (such when creating hyperlink page), use page.getrouteurl
method.
here's code snippet showing use of page.getrouteurl
. it's article, url routing in asp.net 4:
lnkcategory.navigateurl = page.getrouteurl("view category", new { categoryname = "beverages" });
in above snippet, "view category" name of routing rule want use. categoryname
1 of routing parameters , want use value "beverages". above call page.getrouteurl
returns string "/categories/beverages". (of course, exact string returns depends on routing rule "view category" , parameter values, idea.)
Comments
Post a Comment