How to hide database table primary ID in ASP.NET Routes? -
i using asp.net routes first time. here trying achieve.
registered routes in global.asax file
routes.mappageroute("helpeditroute", "help/{action}/{id}", "~/ad/help.aspx") this code inside help.aspx
response.redirect("~/help/edit/12") in code behind page of help.aspx doing redirect following url edit article number 12. here id database table primary key id.
problem: don't want show database primary key(id) browser address bar. there way it?
thanks.
oftentimes referred url slug. and, in manageable scenarios (eg not stack overflow generates url slugs , exposes primary key), easy add user-generated, uniquely indexed field table handle this. code-wise, if stick default routing conventions, lookup based on surrogate key (slug) created rather primary key.
Comments
Post a Comment