By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,893 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

404 Redirect Question

P: n/a
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/cate...otorbikes.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? Is there any external
filters, executables that can make IIS do this?

Thanks,

Dan Chapman
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 4 Dec 2004 13:18:25 -0800, da*@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/cate...otorbikes.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
Jul 22 '05 #2

P: n/a
I actually do this in one of my sites... Someone enters
http://www.mywedding.co.nz/<username> 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" <je*********@zina.com> wrote in message
news:41****************@msnews.microsoft.com...
On 4 Dec 2004 13:18:25 -0800, da*@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/cate...otorbikes.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

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.