Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Other Programming - Perl, C++, Java, ASP, .NET Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-04-2006, 04:44 AM   #1 (permalink)
dhanasekaran1980
Junior Member
 
Join Date: Aug 2006
Posts: 1
Default How to ensure request coming from browser?

Hi,

Can anybody help me how to ensure that the request is coming from the browser. The request many come from search engine or any java program. I need to ignore these requests.

So is there any way to find the request is coming from the browser or someother source through JAVA or JSP.

Thanks

Dhanasekaran.
dhanasekaran1980 is offline   Reply With Quote
Sponsored Links
Old 08-12-2006, 05:43 PM   #2 (permalink)
ahk2chan
Junior Member
 
ahk2chan's Avatar
 
Join Date: Aug 2006
Location: Canada
Posts: 19
Default Re: How to ensure request coming from browser?

Well for the search engine piece you can actually define a robots.txt to disallow robots crawling those protected pages.

However, about browser... I think you can setup something in the httpd.conf (if you are using Apache) that will match the browser string provided by the "browsers". for example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)". Another not-as-safe way is to use javascript to check the browser type...

But at the end of the day, a browser is a "program" too... so users may choose to write a program / crawler that will send the same browser string like Firefox or IE...
__________________
My Blog - ahk2chan blog - my random thoughts.
ahk2chan is offline   Reply With Quote
Old 08-16-2006, 08:03 PM   #3 (permalink)
rjplummer
Junior Member
 
Join Date: Aug 2006
Posts: 4
Default Re: How to ensure request coming from browser?

It's pretty tough to come up with a regex that will match all valid user agants. Plus most search engines, at least in some circumstances, spoof browser user-agents to protect against click-fraud.

If you're comfortable requiring JavaScript, I'd use JavaScript to inject a value that tells you the client's running JavaScript which makes certain it's a browser, e.g.,

ASP/VBScript example:

<%
Randomize
If IsEmpty(Session("injectedvalue")) Then
Session("injectedvalue") = CStr(Rnd())
%>
<html><head><script language="JavaScript">
window.location = "?iv=" + escape("<%= Session("injectedvalue") %>")
</script></head><body>
Innocuous text for spiders, etc.
</body></html>
<%
ElseIf Session("injectedvalue") <> Request.QueryString("iv") Then
Response.Redirect "wherever you want to send non-browsers"
End If
%>
Protected page here


This needs to be a little more complex if the page already has a uri-query on it.
rjplummer is offline   Reply With Quote
Old 08-16-2006, 08:42 PM   #4 (permalink)
ahk2chan
Junior Member
 
ahk2chan's Avatar
 
Join Date: Aug 2006
Location: Canada
Posts: 19
Default Re: How to ensure request coming from browser?

To exclude all robots from crawling:
Code:
User-agent: * Disallow: /
The javascript thing is a good and creative one! Thanks for the info!
__________________
My Blog - ahk2chan blog - my random thoughts.
ahk2chan is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 09:13 AM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums