Click here to Skip to main content
16,013,747 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I wanted to create a URL like http://localhost/menu.aspx/?id so that on typing this in the address bar, it displays all the id's in the database. for eg:
134
123
543
234
may be the id's fetched from the DB which should be displayed as above on the above URL.

These should be displayed as it it is without any control or without arranging in any grid etc. I know how to query the db for the Id's but how do I display them on the webpage on this URL http://localhost/menu.aspx/?id
Posted

1 solution

Visually, this url: http://localhost/menu.aspx/?id, does not make much sense and the 'id' would be ignored. It's not a valid query string.

What you can do is: Use 'URL Rewriting'.
Read here: URL Rewriting with ASP.NET[^]
MSDN: URL Rewriting[^]
OR
Read about, In ASP.NET 4.0: URL Routing[^]

Internally, you can formulate a URL that would do the same thing that you want. Infact, you can also handle the same URL that you want. Once URL rewriting is in place you can handle the URL accordingly and display the data desired.
 
Share this answer
 
Comments
thatraja 16-Jan-11 3:55am    
Good 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