Re: 404 Redirect Question

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Mauricio Freitas [MVP] (dr.emailposter_at_nowhere.invalid)
Date: 01/03/05


Date: Mon, 3 Jan 2005 19:35:41 +1300

I actually do this in one of my sites... Someone enters
http://www.mywedding.co.nz/> and the 404.asp script will looking
the database for <username>. If it exists there's a response.reditect to a
pageload.asp that will build the page and return it, otherwise the 404.asp
shows a "Not found" message.

I just scan the querystring:

 on error resume next
 strRequest = Request.QueryString
 strAbsUrl = LCase(Mid(strRequest, Instr(Instr(1, strRequest, "://") + 3,
strRequest, "/")))
 strAbsUrl = right(strAbsUrl,len(strAbsUrl) - 1)
 on error goto 0

strAbsUrl will contain the bits after .com/...

-- 
Mauricio Freitas, Microsoft MVP Mobile Devices
Bluetooth guides: http://www.geekzone.co.nz/content.asp?contentid=449
Geekzone Software Store: http://www.geekzone.co.nz/store
Our RSS feeds give you up to date information on new software as soon as 
they're available: http://www.geekzone.co.nz/content.asp?contentid=3344
"Jeff Cochran" <jeff.nospam@zina.com> wrote in message 
news:41b541a7.543520150@msnews.microsoft.com...
> On 4 Dec 2004 13:18:25 -0800, dan@danceholidays.com (DanTg) wrote:
>
>>Hi all,
>>
>>I want to build a custom 404 error page that using asp will
>>dynalically build the page.
>>
>>Here is my problem. I am building a directoy website which has over
>>3000 categories. I do not want to create a category page for each one
>>so I though I would try and cheat a little and use the 404 to make it
>>look as if the page exists and put out the relevant information.
>>
>>The website is:
>>http://www.pricerequest.co.uk/
>>
>>The page I am linking to (which does not really exist) is:
>>http://www.pricerequest.co.uk/a/Cars_Motorbikes.html
>>
>>The page you see when you go to
>>http://www.pricerequest.co.uk/a/Cars_Motorbikes.html is actually the
>>404 page.
>>
>>So what I want it to do is the 404 page ASP code will look at the page
>>name 'Cars_Motorbikes' search the categories database table and pull
>>out the category information.
>>
>>So in IIS I tried setting the Custom Errors 404 Message Type as File
>>but IIS does not or I can't get this page to process it as ASP to then
>>dynamically build the page.
>>
>>The 2nd thing I tried was setting the Message Type as URL. This works
>>but the URL string looks like:
>>
>>http://www.pricerequest.co.uk/a/category.asp?404;http://www.pricerequest.co.uk/a/Cars_Motorbikes.html
>>
>>When really I want the URL to look like:
>>
>>http://www.pricerequest.co.uk/a/Cars_Motorbikes.html
>>
>>Does any one know how I can do this in IIS?
>
> You can't.  It's a 404 page, not the page you intend it to be.
>
>>Is there any external
>>filters, executables that can make IIS do this?
>
> I wouldn't think so, but maybe if you don't use ASP.  ASP has to be a
> URL because it needs to be processed by the server, but a file could
> probably be created to do something similar to what you ask.
>
> Jeff 


Relevant Pages

  • Re: ASP & Databases
    ... I am unable to insert a row in a database using an .asp ... I am running IIS 5.1 that comes with Windows XP. ... : in Control Panel. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Problem: DLL VB6 / ASP / Database / Windows 2003
    ... Since the code run in ASP/IIS needs to access other resources (database here) in your second case, the user account configured in IIS for the ASP must have permission to access the said database. ... Dim rs As Recordset ...
    (microsoft.public.vb.general.discussion)
  • ASP & Databases
    ... I am unable to insert a row in a database using an .asp ... I am running IIS 5.1 that comes with Windows XP. ...
    (microsoft.public.inetserver.asp.db)
  • Re: ASP & Databases
    ... > I am unable to insert a row in a database using an .asp ... I am running IIS 5.1 that comes with Windows XP. ... > in Control Panel. ...
    (microsoft.public.inetserver.asp.db)
  • Re: allowing access to a .mba from IIS 6.0
    ... This isn't a function of IIS. ... Then you can use ASP to access the db. ... WebPageChecker - Helps Maintain Server UpTime ... >A website that my company took over uses an access database for .asp ...
    (microsoft.public.inetserver.iis)