Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - 404 Trick for Directory System
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

404 Trick for Directory System

 Post Reply Post Reply
Author
angkorboy View Drop Down
Newbie
Newbie
Avatar

Joined: 02 September 2005
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote angkorboy Quote  Post ReplyReply Direct Link To This Post Topic: 404 Trick for Directory System
    Posted: 10 January 2006 at 3:24am

404 Trick for Web Promotion.

search engine's point of view. It is the biggest benefit to have well named pages. Most search engines, like Alta Vista and Yahoo.For example:
Main Category: www.cambodia-tourism.org/index.asp?cat=26 is not memorable as Main
Category: www.cambodia-tourism.org/Hospitality_Catering
Sub Category: wwww.cambodia-tourism.org/Hospitality_Catering/Beverage ...etc

My directory system in table category in MsAccess:

CategoryID   | CategoryTitle      | ParentCategoryID | Description |   Pagename
26             Hospitality & Catering           0                      Hospitality_Catering
34  Berverage      26              Hospitality_Catering/Beverage

As see in index.asp :

<a href="index.asp?cat=<%=CategoryID%>"><%=CategoryTitle%></a>

But now I change it. Instead of passing the Category id with querystring, I need to get the corresponding PageName and redirect to that page. Such as:

<a href="<%=PageName%>"><%=CategoryTitle%></a>

It will now redirect to:
Category: www.cambodia-tourism.org/Hospitality_Catering

Now I need to create the 404.asp page to handle all 404 page not found errors.

404.asp
<%
' Getting page name
dim PageName
PageName = Request.ServerVariables("QUERY_STRING")
%>
<%
' Category id
dim ID
set obj = Server.CreateObject("ADODB.RecordSet")
obj.Open "select CategoryID from TbleCategory where PageName = '"&PageName&"' ", DBCon
if not obj.EOF then
ID = obj.Fields("CategoryID")%>

<%
'Redirect ot Original Page
transferURL = "index.asp?cat=" + CStr(CategoryID)
Server.execute(transferURL)
%>

<%
Else
Error.asp
End if
%>


I got some problem:

ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/www.cambodia-tourism.ws/404.asp, line 10

Can anyone resolve with this problem?.

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 10 January 2006 at 12:12pm
looks like it might be because you havent included any database connections

do you have a file like "common.asp" which has your database connection in?
if so, you need to include it

*edit*

i just noticed, you might want to use

Request.ServerVariables("SCRIPT_NAME")


since "querystring" would get

PID=96720&PN=1

from this page (edit_post_form.asp?PID=96720&PN=1)

info here

*edit no.2*

again, you might also like to do an SQL Injection check on "PageName" to make sure your not hacked


Edited by Scotty_32 - 10 January 2006 at 6:08pm
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.