Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

I have in my web application the following url : http://localhost:50141/NewsDetails.aspx?NewsId=2[^].And 2 is the id of the news in the database.But what i need is to put the News title instead of the query string to become like this : http://NewsDetails.aspx/Newstitle[^].But i dont know how.And this is what i tried:

C#
if (fullOrigionalpath.Contains("NewsId=2")) {
           Context.RewritePath("/NewsTitle");
       }


So please can anyone give me a hint on how to put the news title which is retrieved from database and put it instead of its corresponding id ?

Thanks in advance.
Posted
Updated 5-Sep-11 2:02am
v2

 
Share this answer
 
Comments
mhamad zarif 5-Sep-11 8:11am    
i have already read this article.But scott is not saying how to make rewriting for dynamic data from database.But he is only saying how to put them if he already knows the query string.
Download the zip file here[^] it has the dll and the documentation. The link is mentioned in ScottGu blog as well.
 
Share this answer
 
It looks like you are using ASP.Net 4.0 so instead of using URL rewriting use URL Routing.

So for every dynamic data add another Route dynamically.

See below links URL Routing with ASP.NET 4.0[^], Url Routing[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900