|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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.... ![]() |
|
#2
|
|||
|
|||
|
Quote:
HTTP_HOST only returns the host. If you want subsequent path info you need to use SCRIPT_NAME Example |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
Quote:
Yes, check the example given. host2 will always force a redirect to error because you aren't using the values correctly. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
||||
|
||||
|
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
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > VBScript - General - Error - Host Redirect Issue |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|