Forum Moderators: open
The scenario:
IIS, ASP.NET, Database with approx 100,000 records. Each record creates its own dynamic page, but with a dirty URL. How best to clean the URLs so that the spiders can index them easily?
But the solution MUST be applicable to our scenario:
1. The URLs must be of the form http://www.example.com/member/1023 (that is, no ".aspx", ".asp" or any other extension)
2. We DO have access to IIS as this is our own server.
3. We DON'T want to install a third party component. We want to install something we can modify ourselves. Probably in the global.asax file using the RewritePath functionality.
4. We DON'T want to map ALL files to be handled by the .net engine.
5. We DON'T want to use a "404" type solution because the 404 page would get loaded up with too much code. We want to separate out each type of page into it's own file.
So, can anybody shed any light on the latest thinking on this? All the solutions and articles I have found online either rely on the URL having a .aspx extension, or installing third party software.
Many thanks, Gordon.
[edited by: Xoc at 12:25 am (utc) on Oct. 27, 2005]
[edit reason] changed to use example.com [/edit]
I guess you're going to need a lot of aspx files and a lot of Server.Transfer statements. I wish you the best of luck trying to maintain it all in the years to come ;-)
If it were me, I'd use ISAPI rewrite. fast, Easy, flexible and maintinable, but obviously that's not masochistic enough for you!
Thanks for the suggestion regarding ISAPI rewrite, but that is a third party component and as I mentioned we don't want to use one.
We don't want to use a 404 based solution so unfortunately that is out.
We can insert a few lines of code into the global.asax file, no problems there.
Could you explain what your proposed solution using Server.Transfer is about? I have not heard of this being used for a production level solution.
Thanks, G.
Only possible gotcha is you need to use RewritePath again to point to the original URL in the destination page, during the Page_Load event if your form posts back to the server.
The site is quite small (100 pages) so maybe it wouldnt be scaleable? I'm no expert so I'm not sure if this is a good way to do it but it works for me.
If you need help just ask - I did this for a client on a shared hosting account so we didn't have access to anything powerful in IIS either.
When a "member" is created I create a folder from them and do a quick copy of a blank index.aspx into that folder.
I then use Scott Mitchells rewriter app to do the following:
1) Parse all text after "members/" using a regex. Put that text into a variable.
2) Redirect to showmembers.aspx?id={text from step 1}
All the user ever sees is site.com/members/1023 but they're actually at showmembers.aspx?id=1023 All it actually takes is a few lines in web.config once you get the urlrewriter in.
[15seconds.com...]