Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 01-24-2006, 09:23 PM HTTP_REFERER help
Junior Talker

Posts: 2
Trades: 0
I want to have one of my asp pages ONLY load if someone reached it by my main page. I am new to ASP, but I think I have the theory down, I just need help with the actual commands, syntax, etc. Here is what I got so far, any suggestions?

ref=Request.ServerVariables("HTTP_REFERER")
If ref=http://website.com/main_page.htm then goto continue
Else goto end

continue()
..... run the code on this page .....
end()
Response.Write "You Have Not Reached This Page From Our Main Site"
cbassoc is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-25-2006, 05:13 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
First of all, since the URL is a string, you will need to put it in quotes.
Secondly, loose to goto statement. It's incredibly bad coding practise to use GOTO.
Code:
if Request.ServerVariables("HTTP_REFERER") <> "http://website.com/main_page.htm" then
    Response.Write("You Have Not Reached This Page From Our Main Site")
else
    ' Page Code Here
end if
Lastly, remember that the HTTP_REFERER is sent by the client - so it can't be relied upon in 100% of cases, and it can be easily forged by a malicious user.

- Mina
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Minaki; 01-25-2006 at 05:18 AM..
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 01-25-2006, 08:23 PM
Junior Talker

Posts: 2
Trades: 0
THank you! I am real new to ASP and VBScript so I am getting the hang of syntax, etc.

I was also thinking of placing some type of variable on the refering page that can be read by the redirected page. Something that I can change every few months, etc.
cbassoc is offline
Reply With Quote
View Public Profile
 
Old 01-26-2006, 05:06 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
By the way, if you're just starting to lean, you might want to bear in mind that ASP is old now. ASP.NET is the new version - it's based on Microsoft's .NET Framework. It's far more structured and (in my oppinion) easier to learn than standard ASP.
You can find out more at http://www.asp.net
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to HTTP_REFERER help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20008 seconds with 12 queries