Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old June 6th, 2003, 02:27 PM
mstubble mstubble is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 8 mstubble User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
VBscipt / ASP question...

I am creating a script that does the following:

-User types URL: whatever.com/directory
-User is redirected to 404.asp error page
-404.asp page checks to see if whatever/directory is setup to forward to a specified URL, if it is, it redirects them to the URL. If not they stay on the 404.asp page.

I've got this aspect working...Now, what I don't know how to do is strip out the URL so if a user types in whatever.com/directory -- (Html, asp, htm etc.. etc..) they will still be directed to the proper place.

In other words, I only need it to read what comes after the /whatever in the URL line. That way if people type /directory.html /directory.asp etc... It will ignore the .asp .html or even .serjkwerjkwe for that matter. I just need it to ignore anything typed after that point and send them to the proper URL.

I want to eliminate all user error but I don't want to have to enter each specic incorrect URL tag that they could type. I just want it to strip out the /directory and that's it.

This is the code I have so far:


<%
'Get the user-requested URL
requestedURL = Replace(Replace(Replace(Replace(Replace(Request.ServerVariables("QUERY_STRING"),"404;http://www.visionforum.com",""), "/", ""), ".asp", ""), ".htm", ""), ".html", "")

If requestedURL = "doll" Then
Response.Redirect("/beautifulgirlhood/productinfo.asp?number=72564")
Else%>


Any ideas how to best do this?

Reply With Quote
  #2  
Old June 6th, 2003, 03:24 PM
defjamninja defjamninja is offline
Overly white
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fresno, CA
Posts: 83 defjamninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
PHP Code:
 Dim sURL
Dim iPos

sURL 
Request.ServerVariables("QUERY_STRING")
iPos Instr(8,Request.ServerVariables("QUERY_STRING"),"/")
sURL Left(sURL,Len(sURL)-iPos


I think that will do it for you. I don't have a server to test it right now or VB on this system.

Reply With Quote
  #3  
Old June 6th, 2003, 03:39 PM
mstubble mstubble is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 8 mstubble User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks.

I can't seem to get that to work for some reason. I'll tweak with it a bit but I'm not exactly sure what the deal is. (Plus I don't really know what I am doing

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > VBscipt / ASP question...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway