tags:

views:

31

answers:

2

Hi,

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>
+1  A: 

Hi,

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

Serving Dynamic Content with HTTP Handlers

DevExpress Team
Thanks a lot for your assistant. But, there is bit difference as per requirement. There is only the way how we can handle different extensions. But in our case there is a customized url too. Also we need to access this information on virtual pages which are not exist physically. Words from you will be most appreciated.
Rick
You can check an url requested by implementing a new IHttpHandlerFactory. This information can be obtained using the context.Request object. Also, this approach implies that you have several templated pages whose compiled version is returned in the GetHandler method. Finally, you can save the page's identifier to the context.Items object and fetch it in the page's Load event. You will find an example on how this can be done in the same MSDN article.
DevExpress Team
A: 

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.

Wyatt Barnett
@Wyatt - This is what I was wondering. Could you provide any reference article/link for the same?
Rick