Solved

Request.Servervariables redirect

Posted on 2000-04-14
11
266 Views
Last Modified: 2006-11-17
I want to give each item in my Db it's own "static" page. I will do that by capturing the id and passing the id number to a search page.  I want to see if it is possible to pull the item number directly from the url without having to include a .asp file in the url.  

Example:

www.somerandomsite.com/123456  which i would pull the number 123456. and redirect to the search page.

i can do this with www.somerandomsite.com/default.asp?123456 but am trying to keep the url as short as possible and allow any user to be able to remember what to enter without having to type in all that information.

Is there a way i can force all request for that directory to go to the default.asp page and then pull the last digits off, again without making the user type in default.asp.


Thanks in advance

0
Comment
Question by:webmatt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 4

Expert Comment

by:jkunal
ID: 2715782
You can write an ISAPI filter for this.

(OnUrlMap)

find out the number and redirect it to the related page.
0
 

Author Comment

by:webmatt
ID: 2715869
How complicated is that.  I haven't done it before.

0
 

Author Comment

by:webmatt
ID: 2715886
How complicated is that.  I haven't done it before.

0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 10

Expert Comment

by:makerp
ID: 2715928
very :)

just write a default.asp that takes a querysting parameter say called page id then in the default.asp take the id get the page and then do a response.redirect. you could even store the page in the db and just print it to the user..

i.e

default.asp

pageid = Request("pageid")
Set con = Server.createobject("ADODB.Connection")
con.Open your dsn
Set rs = con.Execute("SELECT * FROM pages WHERE page_id = "pageid)

THEN EITHER

response.redirect(rs("filename"))

OR

response.write(rs("contents"))

filename will be the name of the file and it will be held in the db or you could hold the whole contents and use response.write to put it out.
the contensts will have to be a memeo field

0
 

Author Comment

by:webmatt
ID: 2716142
makerp

this will work but i cant advertise every item as www.somerandomsite.com/default.asp?id=12345.

it just isn't memorable and the average consumer wont remember it.  which is why i'll have to check out isapi unless someone has another suggestion.

thanks
0
 
LVL 10

Expert Comment

by:makerp
ID: 2716161
dont use an id then use a filename instead or some other meaning full word for each file
0
 
LVL 10

Expert Comment

by:makerp
ID: 2716200
even if you use an isapi you will still have to pass it some kind of identifier so it can detaermine the page to display...

writting an isapi will be a serious over kill here
0
 

Expert Comment

by:ssoni
ID: 2717358
Maybe this helps. But youwill have to do a bit of digging. In Apache there is an option called MultiViews or the Alias option.

For example if you have MultiViews turned on and you have a file called
abc.cgi in your document root, (or if /abc is Aliased to abc.cgi)
then requesting:
    http://my.domain.com/abc/foo
.... would run abc.cgi with the PATH_INFO server-variable set to 'foo'.

So if you query for SERVERVARIABLES "PATH_INFO" u will get 'foo'.

Check out if your web server supports aliases and then u should be able to do what u want.

Soni.
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 100 total points
ID: 2718724
You can set up custom error responses.
For instance, if you request :

http://www.somesite/dir/page.asp and the page is not there you get a 404 error and an error page is displayed.

You could configure your server to display http://www.somesite/dir/default.asp whenever a 404 ocurrs in that directory.

Then you use default .asp to query the headers and display the real page either by redirecting or by pulling it into a full-size frame within default.asp.
0
 

Author Comment

by:webmatt
ID: 2777876
This works great!

thanks
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 2778559
No problem.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question