Gaurav Arora
Gaurav Arora

Reputation: 2324

How to apply custom url without using url-rewriting?

I am creating a dynamic website in asp.net based on content fetching from MSSQL DB. What I want to do is : everycontent has its own link/url based on contentId-Title. How can I do this?

Example: Table has : ID :1 Title : Mytitle Description :This is description Extension : .html Url :

Now, I need to show the all results in a datagrid with title link as:

Title : mytitle => Now whenever anybody clicks on it it will resolve in the form of : "/1-mytitle.html"

So, formula to create url is : ID-Title Extention for instance above will generate as :

<a href="/1-mytitle.html">MyTitle</a>

Upvotes: 0

Views: 218

Answers (2)

Wyatt Barnett
Wyatt Barnett

Reputation: 15663

Check out routing, its a part of ASP.NET 3.5 SP 1 or later. It should be able to do what you need.

If you are somehow stuck on 2.0, you can fake the inbound parts of routing by using custom mapped http handler factories, but I can't think of a case where upgrading to 3.5 would not be more cost effective.

Upvotes: 0

DevExpress Team
DevExpress Team

Reputation: 11376

Such tasks can be implemented by creating a custom HttpHandler. For more details, please refer to the MSDN:

Serving Dynamic Content with HTTP Handlers

Upvotes: 1

Related Questions