Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Request.Servervariables redirect

Posted on 2000-04-14
11
Medium Priority
?
274 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 400 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

636 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