ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

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
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 12th, 2009, 05:09 PM
Jinx-Inc Jinx-Inc is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 53 Jinx-Inc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 23 m 6 sec
Reputation Power: 2
VBScript - General - Error - Host Redirect Issue

Hi

My hosting company have said that for my .net stuff to work it needs to be redirected first hand. They have given me this code which I have changed to suit myself but it doesn't work.

Code:
<%EnableSessionState=False

host = Request.ServerVariables("HTTP_HOST")

if host = "linusit.co.uk/private/" or host = "www.linusit.co.uk/private" then
response.redirect("http://www.linusit.co.uk/index.asp")

else if host = "linusit.co.uk/private/" or host = "www.linusit.co.uk/private/" then
response.redirect("http://www.linusit.co.uk/private/index.asp")

else
response.redirect("http://www.linusit.co.uk/error.htm")

end if
%>


It works if you go to linusit.co.uk or www.linusit.co.uk but the private side of it isn't working at all and I am at a complete loss!

Please help....

Reply With Quote
  #2  
Old November 13th, 2009, 02:47 AM
Jonathan8146 Jonathan8146 is offline
Contributing User
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2005
Posts: 1,878 Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 20 h 41 m 50 sec
Reputation Power: 301
Quote:
Originally Posted by Jinx-Inc
Hi

My hosting company have said that for my .net stuff to work it needs to be redirected first hand. They have given me this code which I have changed to suit myself but it doesn't work.

Code:
<%EnableSessionState=False

host = Request.ServerVariables("HTTP_HOST")

if host = "linusit.co.uk/private/" or host = "www.linusit.co.uk/private" then
response.redirect("http://www.linusit.co.uk/index.asp")

else if host = "linusit.co.uk/private/" or host = "www.linusit.co.uk/private/" then
response.redirect("http://www.linusit.co.uk/private/index.asp")

else
response.redirect("http://www.linusit.co.uk/error.htm")

end if
%>


It works if you go to linusit.co.uk or www.linusit.co.uk but the private side of it isn't working at all and I am at a complete loss!

Please help....


HTTP_HOST only returns the host. If you want subsequent path info you need to use SCRIPT_NAME
Example

Reply With Quote
  #3  
Old November 13th, 2009, 06:28 PM
Jinx-Inc Jinx-Inc is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 53 Jinx-Inc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 23 m 6 sec
Reputation Power: 2
I have tried the following but it hasn't worked

Code:
<%EnableSessionState=False

host = Request.ServerVariables("HTTP_HOST")
host2 = Request.ServerVariables("SCRIPT_NAME")

if host = "linusit.co.uk" or host = "www.linusit.co.uk" then
response.redirect("http://www.linusit.co.uk/index.asp")

end if

if host2 = "linusit.co.uk/private/" or host2 = "www.linusit.co.uk/private/" then
response.redirect("http://www.linusit.co.uk/private/index.asp")

else
response.redirect("http://www.linusit.co.uk/error.htm")

end if
%>


Any ideas?

Reply With Quote
  #4  
Old November 16th, 2009, 04:31 AM
Jonathan8146 Jonathan8146 is offline
Contributing User
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2005
Posts: 1,878 Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level)Jonathan8146 User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 20 h 41 m 50 sec
Reputation Power: 301
Quote:
Originally Posted by Jinx-Inc
I have tried the following but it hasn't worked

Code:
<%EnableSessionState=False

host = Request.ServerVariables("HTTP_HOST")
host2 = Request.ServerVariables("SCRIPT_NAME")

if host = "linusit.co.uk" or host = "www.linusit.co.uk" then
response.redirect("http://www.linusit.co.uk/index.asp")

end if

if host2 = "linusit.co.uk/private/" or host2 = "www.linusit.co.uk/private/" then
response.redirect("http://www.linusit.co.uk/private/index.asp")

else
response.redirect("http://www.linusit.co.uk/error.htm")

end if
%>


Any ideas?


Yes, check the example given. host2 will always force a redirect to error because you aren't using the values correctly.

Reply With Quote
  #5  
Old November 24th, 2009, 12:18 PM
Jinx-Inc Jinx-Inc is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 53 Jinx-Inc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 23 m 6 sec
Reputation Power: 2
I have looked again at the example but cannot work it out, can someone help me with this please as it's really causing me trouble now.

Thanks

Reply With Quote
  #6  
Old November 26th, 2009, 05:38 PM
Jinx-Inc Jinx-Inc is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 53 Jinx-Inc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 23 m 6 sec
Reputation Power: 2
Anybody able to help me with this?

I can't use my .net application until I get this redirection sorted! I wish typing the url worked, would be so much simplier.

Reply With Quote
  #7  
Old November 30th, 2009, 12:52 AM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 1,637 keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level)keep_it_simple User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 15 h 35 m 6 sec
Reputation Power: 984
Send a message via Yahoo to keep_it_simple
have you debugged your host or host2 values?


it seems pretty straightforward that if the condition finds 1 or the other string assigned it will redirect accordingly. what is the response.write host print out?
Code:
<%
  host = Request.ServerVariables("HTTP_HOST")

   response.write host
   response.end

  Select Case host
     Case "linusit.co.uk/private/", _
            "www.linusit.co.uk/private"

          response.redirect("http://www.linusit.co.uk/index.asp")
     
    Case "linusit.co.uk/private/", _
           "www.linusit.co.uk/private/"
        
          response.redirect("http://www.linusit.co.uk/private/index.asp")
   
     Case Else
   
      response.redirect("http://www.linusit.co.uk/error.htm")
  End Select
%>
__________________
Please give respect to those that helped solve an issue by clicking on the reputation icon

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > VBScript - General - Error - Host Redirect Issue


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!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

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





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek