Asp – How to return a classic asp page with a different name than the asp page on the server

asp-classicweb-applications

Is it possible to return to the web client a page named differently than the original classic asp page read from the web servers folder ?

F.i. a real example I would like to implement: let's say I have an classic asp called

calendar.asp

If this page is called today (Jan 6, 2010) the page returned to the client web site should be:

calendar-of-january-6-2010.asp

If the same page should be called tomorrow, the page returend to the client web site should be:

calendar-of-january-7-2010.asp

You get the picture. Based on some internal logic, return a specific named classic asp page to the web client .

Thanks for any input you might provide.

UPDATE: The specific date files in the above example do not exist physically (or I could use a redirect).
I was hoping to find something like I use to return a csv file:

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=export.csv"

Not the same, of course, cause this will let the client browswer prompt for the save/open box. Just something similar.

Best Answer

OK, seen your edit about wanting to link to daily calendars.

Think of it like this:

  1. Build your pages so that the links are to friendly URLs - /calendars/jan-01-2010.asp, /calendars/jan-02-2010.asp, and so on.
  2. Configure IIS to use a custom 404 error for /calendars/ - so that whenever a client requests a page here that doesn't exist, your server will run calendar.asp (instead of just sending back "404 Page Not Found")
  3. That's it. Your client will never see the URL "calendar.asp", because they're never requesting it. All they're doing is following the friendly links you're giving them. It's your server that's doing the clever bit (catching the "invalid" requests, and pretending there's actually a valid page at that URL)

StackOverflow works like this - it uses ASP.NET MVC and the ASP.NET routing engine to intercept those friendly-looking question URLs, look them up in the database, and return a generated page, so that to users (and search engines) it looks like there are thousands of friendly-named pages, when it's actually all happening behind-the-scenes.

Related Topic