Link to home
Start Free TrialLog in
Avatar of Mark Wood
Mark WoodFlag for United States of America

asked on

ASP Help

Can someone pleae help me figure this code out. I am missing something.
<%
            URL=Request.ServerVariables("HTTP_REFERER")
            response.write URL
 
            if URL = "tdwtech.com" then
            response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>TDW Technologies<br>Helpdesk Case Manager</font></h3>"
            end if
 
            if URL = "www.tdwtech.com" then
            response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>TDW Technologies<br>Helpdesk Case Manager</font></h3>"
            end if
 
            if URL = "aandccomputerservices.com" then
            response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>A & C Computer Services<br>Helpdesk Case Manager</font></h3>"
            end if
 
            if URL = "www.aandccomputerservices.com" then
            response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>A & C Computer Services<br>Helpdesk Case Manager</font></h3>"
            end if
            %>

Open in new window

Avatar of Ken Fayal
Ken Fayal
Flag of United States of America image

We would be able to help you out if you posed a question.  What is wrong with it?
I'm guessing that HTTP_REFERER doesn't work for you.  Here's an article on why it doesn't work in certain circumstances:

http://classicasp.aspfaq.com/general/what-is-wrong-with-request-servervariables-http-referer.html
Avatar of Wayne Barron
Maybe?
As mentioned above, you need to explain what it is that you are needing.

Tested code and works great.
(I put your links back as you had them, but my test ran great.)
Test Link
http://ee.cffcs.com/Q_24347700/Q_24347700.asp

Hope this is what you are wanting, if not, then please explain a little more then what you have here.

Carrzkiss
<%
URL=Request.ServerVariables("HTTP_REFERER")
response.write URL
 
if URL = "tdwtech.com" then
response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>TDW Technologies<br>Helpdesk Case Manager</font></h3>"
 
elseif URL = "www.tdwtech.com" then
response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>TDW Technologies<br>Helpdesk Case Manager</font></h3>"
 
elseif URL = "aandccomputerservices.com" then
response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>A & C Computer Services<br>Helpdesk Case Manager</font></h3>"
 
elseif URL = "www.aandccomputerservices.com" then
response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>A & C Computer Services<br>Helpdesk Case Manager</font></h3>"
end if
%>

Open in new window

The only way the link will work above in this demo, is to click on this link.
Then click on that link

http:Q_24347700.html#a24212226

Then click on the link
http://ee.cffcs.com/Q_24347700/Q_24347700.asp

When the URL Changes, it is hard to do this stuff right.

Carrzkiss
OK.
Finally got it.
Click on this link.
ASP Help

This link will put only the Main URL up and remove the rest of the stuff.
So, this should go through now.

Sorry, as mentioned, this is hard to do with changing URL's.

http://ee.cffcs.com/Q_24347700/Q_24347700.asp


That should do it.
Sorry for all the post, just trying to get this demo to work right.

Carrzkiss
Avatar of Mark Wood

ASKER

My problem is that if you go to http://tdwtech.com and the click on the helpdesk link at the top of the page the code does not display the text i have in there .. but it does display the reffering url so i know it is capturing it correctly.
Just went onto the link, and the [helpdesk] link.
Does not display nothing, it is a blank page.
Yes, I would do a Response.Write(Request.ServerVariables("HTTP_REFERER")) just to actually see what is in there.  None of the if cases are firing so you want to see what the variable DOES contain.
It does now .. i had tried moving the code to a test.asp file
I see the problem.  It only seems to work in Internet Explorer, and not Firefox.
Here's an article to read with a good solution to the problem.  In their case it was backwards, worked in Firefox, but didn't work in IE.  I would take a look at this:

http://www.sitepoint.com/forums/showthread.php?t=310184
I am getting a Login page with the URL showing and [VUNET Support] showing at the bottom.

IE6, Firefox 3.0.5, Opera 9.64, Safari 3.2.1

What exactly do you want the page to show?
KaptainKenbo:
What is that did not work in Firefox that worked in IE?
As I am see the same exact page in all 4 of the browsers that I have listed:
IE6, Firefox 3.0.5, Opera 9.64, Safari 3.2.1

Please elaborate
For me on Firefox 3.0.9 it is only showing a blank page.  The bottom line is that the HTTP_REFERER server variables should not be relied upon, as the article shows.
I am using IE 7 . If you read the script above you will see that there are 2 referring urls. Depending on the reffering url it should display the correct text above the logon form on that page. I currently have added to the script above a line which shows that the correct refferers are being retrieved. (response.write URL) that is why you should see http://tdwtech.com displayed above the form.
OK>
Firefox 3.0.9
I am getting the same thing as the other browser.
URL showing
Login Form
[VUNET Support]

The   HTTP_REFERER
Is working in Firefox 3.0.9
So there is not an issue there.

Just need to get it to show your other Info.
I think the suggestion in the thread I provided should be considered.  If I am seeing something different between Firefox and IE7, and we all seem to get different results, then the information in the thread - although the situation is swapped in their story - should be considered.
even when you do
http://www.tdwtech.com/
It shows the same identical information as with
http://tdwtech.com/
(But the URL Changes)

It does not seem that it is working on either of them?
that is the problem .. the reffer is working correctly. even if you go to http://www.aanccomputerservices.com and click the helpdesk link the proper refferer is shown. it just will not display the proper text as the script should do.
that is a dead link
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok all links now work .. just to let you now i tried something with the code and this is what happened.

i changed the code as follows:
<%
            REFERER=Request.ServerVariables("HTTP_REFERER")
            response.write REFERER
             
            if REFERER = "http://tdwtech.com" then
            response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>TDW Technologies<br>Helpdesk Case Manager</font></h3>"
else
response.write"<h3 align='center'><font color='#003399' face='Verdana, Arial, Helvetica, sans-serif'>123<br>4567</font></h3>"
            end if
%>

when i did that the text "123 4567" did display even though i came from tdwtech.com. so for some reason even though the referer is correct it wont display the proper text.

i have since changed the code back to the original as diplayed above.
Thanks Carrzkiss for all your help on this. The solution was the same as the More ASP Help Question but you really earned the points here in just sticking with it and helping me figure this stuff out.
your welcome.
Keep on coding.

Carrzkiss