views:

91

answers:

5

Well, simple question. I'm working with VS2008 on an ASP.NET web application which has several lists of data. To keep it simple, let's call it an image gallery. (It's not, but image galleries have a simple, understandable data model as example.) I have a table with images where every image has a name and a category. Images are grouped by category and selectable by name. Easy, right? :-)

I created http://site/ImageList.aspx which accepts an optional parameter (like http://site/ImageList.aspx?category=Ladies) which will display a list of all images, or all images from a specific category. And I created http://site/Image.aspx?name=Cassandra which will display a specific image.

But I would like the user to see things like:

instead. And this should be arranged from within the application itself, not by making modifications to the IIS server.

So, can someone provide me a step-by-step overview showing how to build a web application like this? (I know it has to do something with routing and with UriTemplate's. I can Google for it and tried that, but the amount of information just adds to the confusion.)

Unfortunately, I have to deal with one additional problem: ASP.NET MVC is a good technique but I have to work without these additional downloads. I am restricted to the options that VS2008 by default offers. (Basically, Management in all their "wisdom" told me not to use it.)

+3  A: 

take a look at asp.net mvc

but it's quite possible to use ASP.NET Routing in a traditional way (ASP.Net form). Follow step-by-step instructions on how to do it here

Anwar Chandra
Done that, can't introduce MVC in my project, though.
Workshop Alex
have you checked my 2nd link?
Anwar Chandra
Just noticed it after the comment. Good link! Exactly what I was looking for.
Workshop Alex
If i where u and i could use MVC try this out http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/It's a good article
Issa Qandil
If I could use MVC, I'd had a much easier job. Then again, if I didn't have a pointy-haired manager, my job would be much easier. :-)
Workshop Alex
+1  A: 

You should use URL rewrite technology + regex clauses

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

http://msdn.microsoft.com/en-us/library/ms972974.aspx

omoto
Please, suggest something more ASP-NET-like...
Workshop Alex
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspxhttp://msdn.microsoft.com/en-us/library/ms972974.aspx
omoto
Better...... :)
Workshop Alex
A: 

Mod Rewrite. However, URL writing should be included in most frameworks, and I suggest you use those :)

TIMEX
+1  A: 

The .NET 4 Framework is going to support Routes for WebForms (similar to the MVC Routing) Until then you should use the standard rewriting techniques.

Henrik P. Hessel
The .Net 3.5sp1 Already do
Issa Qandil
Here u go http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/
Issa Qandil
A: 

You are talking about URL rewriting. I've used Madgeek RedirectModule, which reads rules from web.config and redirects/rewrites accordingly.

It's worth noting that you will need to configure IIS to send all requests through the .NET engine if you want to redirect or rewrite on folders or file extensions other than .aspx

You can find a comprehensive guide to URL rewriting here: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

I have two limitations: I have to use VS2008 only. (Fortunately with SP1.) So no additional downloads. And anything that needs to be configured needs to be done from within the web application. Modifying the IIS configuration is considered "bad" by management.
Workshop Alex