473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

select redirect not working

229 100+
Hi, I have this select redirect that doesnt work, only the case else works, anyone see whats wrong with it? Its basically to redirect my dynamic pages to their new homes.
Any help appreciated.
Thanks
Richard


Expand|Select|Wrap|Line Numbers
  1. <%@Language=VBScript%> 
  2.  
  3. <% 
  4. SiteNameURL = Request.ServerVariables("SERVER_NAME") 
  5. %> 
  6.  
  7. <% 
  8. Select Case SiteNameURL 
  9.  
  10. Case "http://www.mysite.com/directory.asp?categoryid=1" 
  11. response.redirect "am-art.asp" 
  12.  
  13. Case "http://www.mysite.com/directory.asp?categoryid=2" 
  14. response.redirect "uf-art.asp" 
  15.  
  16. Case "http://www.mysite.com/directory.asp?categoryid=3" 
  17. response.redirect "uf-art.asp" 
  18.  
  19. Case "http://www.mysite.com/directory.asp?categoryid=4" 
  20. response.redirect "uf-art.asp" 
  21.  
  22. Case "http://www.mysite.com/directory.asp?categoryid=5" 
  23. response.redirect "uf-art.asp" 
  24.  
  25. Case "http://www.mysite.com/directory.asp?categoryid=6" 
  26. response.redirect "uf-art.asp" 
  27.  
  28. Case Else 'redirecting everything other than cases selected above 
  29.  
  30. response.redirect "./" 
  31.  
  32. End Select 
  33.  
  34. %>
Sep 23 '08 #1
2 2567
DrBunchman
979 Expert 512MB
Hi Richard,

If only your Case Else is being hit then none of your other conditions are being met. I'd comment out the redirect and response.write the value of SiteNameURL to the screen so you can see whether it looks as you'd expect.

Also, as the only difference between the urls is the value of the querystring variable categoryid would it not make sense to test for that rather than the whole address? e.g.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim iCategoryID
  3. iCategoryID = Request.Querystring("categoryid")
  4.  
  5. Select Case iCategoryID
  6.     Case 1
  7.      'Redirect 1
  8.     Case 2
  9.      'Redirect 2
  10. etc
  11. End Select
  12. %>
  13.  
Let me know if this helps,

Dr B
Sep 24 '08 #2
fran7
229 100+
Thanks Dr B, worked perfectly. Basically this for anyone interested is a dynamic redirect that works fine.


Expand|Select|Wrap|Line Numbers
  1. <%@Language=VBScript%> 
  2.  
  3. <% 
  4. Dim iCategoryID 
  5. iCategoryID = Request.Querystring("categoryid") 
  6. Select Case iCategoryID 
  7. case "1" 
  8. Response.Status="301 Moved Permanently"
  9. Response.AddHeader "Location","newaddress.asp"
  10. case "2" 
  11. Response.Status="301 Moved Permanently"
  12. Response.AddHeader "Location","newaddress.asp"
  13. case "3" 
  14. Response.Status="301 Moved Permanently"
  15. Response.AddHeader "Location","newaddress.asp"
  16. case "4" 
  17. Response.Status="301 Moved Permanently"
  18. Response.AddHeader "Location","newaddress.asp"
  19. case "62" 
  20. Response.Status="301 Moved Permanently"
  21. Response.AddHeader "Location","newaddress.asp"
  22. case "5" 
  23. Response.Status="301 Moved Permanently"
  24. Response.AddHeader "Location","newaddress.asp"
  25. case "55" 
  26. Response.Status="301 Moved Permanently"
  27. Response.AddHeader "Location","newaddress.asp"
  28.  
  29. Case Else 'redirecting everything other than cases selected above 
  30.  
  31. response.redirect "./" 
  32.  
  33. End Select 
  34. %>
Sep 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: cooldv | last post by:
i have an *access database + ASP newsletter* that is working fine and it sends newsletter to ALL the email addresses in the DB. i want to send this newsletter to only a select group (like people...
3
by: Bill | last post by:
I have a page that contains processed variables that I'd like to forward using the response.redirect method. However, because the response.redirect contains the page within "pagename.asp", I have...
3
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
1
by: Ravindra | last post by:
Hi, Im trying to use Response.Redirect in Session_End event in Global.asax page, which is not working. Why this is not working? And if this not works here, how do I hanlde this? Any possible and...
3
by: mark.irwin | last post by:
Hello all, Have an issue where a redirect pushes data to a page with a select case which then redirects to another page. Problem is the redirect isnt working in 1 case. Code below: strURL =...
3
by: Marc Hoeijmans | last post by:
Hello, I have a problem with the Response.Redirect. The redirect is working for some users for other useres it is not working. We all use the same browser. I have coded the Response.Redirect after...
4
by: nkoier | last post by:
Hi, I've been going crazy trying to figure out what's wrong with our Asp.Net 2.0 intranet site. At the very top of our main page I provide a TextBox and a Button for submitting Google searches....
12
by: =?Utf-8?B?cGI=?= | last post by:
I am having trouble doing a redirect in an async asp.net implemention. Most of the time it works, but when it doesn't it just "hangs", the browser never gets any return page. If I run it under the...
7
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am trying to set this up using asp code and IIS configuration. But it seems not working. Here it is the way I am doing. In IIS I set up a virtual directory with secure communication, I...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.