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 September 15th, 2008, 02:22 AM
Kyriakos Kyriakos is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 68 Kyriakos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 32 m 25 sec
Reputation Power: 5
Exclamation Detect the browser with ASP

hi everyone,

i have this script in PHP that detects the browser of the visitor but i want to translate this to ASP.
PHP Code:
if (ereg("msie"$br)) {
this
} else {
other



thanks in advance!

Reply With Quote
  #2  
Old September 15th, 2008, 02:33 AM
webb webb is offline
Help and be helped
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2004
Location: Australia
Posts: 572 webb User rank is Second Lieutenant (5000 - 10000 Reputation Level)webb User rank is Second Lieutenant (5000 - 10000 Reputation Level)webb User rank is Second Lieutenant (5000 - 10000 Reputation Level)webb User rank is Second Lieutenant (5000 - 10000 Reputation Level)webb User rank is Second Lieutenant (5000 - 10000 Reputation Level)webb User rank is Second Lieutenant (5000 - 10000 Reputation Level)webb User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 21 h 13 m 50 sec
Reputation Power: 68
Code:
If InStr(1, Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") then
  Response.Write "IE"
Else
  Response.Write "NOT IE"
End If
Comments on this post
micky agrees!
__________________
Life is Good

Reply With Quote
  #3  
Old September 15th, 2008, 02:35 AM
micky's Avatar
micky micky is offline
Couch Potato Wizard
Click here for more information. Click here for more information
 
Join Date: Jan 2005
Location: India
Posts: 13,110 micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)micky User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 1480 Folding Title: Novice Folder
Time spent in forums: 5 Months 3 Weeks 2 Days 22 h 51 m 55 sec
Reputation Power: 2502
__________________
Laziness is my religion and Sunday is my God

Get the Mantra!

Reply With Quote
  #4  
Old September 15th, 2008, 02:39 AM
Kyriakos Kyriakos is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 68 Kyriakos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 32 m 25 sec
Reputation Power: 5
Quote:
Originally Posted by webb
Code:
If InStr(1, Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") then
  Response.Write "IE"
Else
  Response.Write "NOT IE"
End If


thank you my friend. it's working.

Reply With Quote
  #5  
Old September 15th, 2008, 02:41 AM
icoombs's Avatar
icoombs icoombs is online now
Moderator
Click here for more information.
 
Join Date: Dec 2006
Location: West London, UK
Posts: 2,560 icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level)icoombs User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 2 h 19 m 37 sec
Reputation Power: 896
Send a message via MSN to icoombs Send a message via Skype to icoombs
Hi

You have to use the Request.ServerVairables("HTTP_USER_AGENT") which will return the following for IE 7...

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727)

You can then use...

Code:
strBrowser = Request.ServerVairables("HTTP_USER_AGENT")
If InSrt(strBrowser, "MSIE7") > 0 Then
    strUserBrowser = "IE 7"
Elseif InStr(strBrowser, "Mozilla/5.0") > 0 Then
    strUserBrowser = "FireFox"
End if


You need to add an elseif for each browser user agent string.
__________________
Hope this advice helps.

If so please show your appreciation by adding reputation points (click gauge image on top right of this post).

- Post your code - Post your errors - Be clear - Be courteous -

AND PLEASE...Finalise your thread with a solution or confirmation that the last advice worked or failed.

Visit My ASP Free Members Club Profile

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Detect the browser with ASP


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 | 
  
 



Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.


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