c# - Url Routing using ASP.NET -


i have:

<a href='news.aspx?id=<%#eval("id") %>'>read more</a> 

and querystring setup this:

sqlconnection con = new sqlconnection(strcon); sqlcommand cmd = new sqlcommand("select * zaebancii id=@id", con); sqldataadapter apd = new sqldataadapter(cmd); dataset ds = new dataset(); cmd.parameters.addwithvalue("@id", page.request.querystring["id"].tostring()); con.open(); apd.fill(ds, "zaebancii"); cmd.executenonquery(); con.close(); formview1.datasource = ds; formview1.databind(); 

how can url rewrite link news/{id} e.g. news/4/ shows post of id of 4 thank you

place these codes in global.asax

protected void application_start(object sender, eventargs e) {     registerroutes(routetable.routes); }   public static void registerroutes(routecollection routes) {      routes.mappageroute("", "news/{id}", "~/news.aspx"); } 

and can id this;

routedata.values["id"]; 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -