ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
  #1  
Old October 15th, 2003, 03:17 AM
hiron hiron is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 hiron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Passing java variables to asp

I am trying to capture user info browsing my site and save it to a text file on my server.
ASP does not seem to provide all the user info i need (resolution etc) So i am getting these through java.


I am using the following java script which is capturing user info correctly.

<script type="text/javascript">

var info = "BROWSER: " + navigator.appName + " BROWSERVERSION: " + navigator.appVersion + " CODE: " + navigator.appCodeName + " PLATFORM: " + navigator.platform + " REFERRER: " + document.referrer + " SCREEN RESOLUTION: " + screen.width + "*" + screen.height + " AVAILABLE VIEW AREA: " + window.screen.availWidth + "*" + window.screen.availHeight + " COLOR DEPTH: " + window.screen.colorDepth + " IP: " + location.hostaddress


Then i am using asp to write to a text file also working fine (with an asp defined variable that is.)

<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("logfile.txt", ForAppending, True)
f.Write Contents
f.Close
set f = nothing
set fso = nothing
%>
</script>


The problem is how to pass this information captured with java to asp. The following between the two scripts is not working. What must i do?

<%Contents = info%>

Reply With Quote
  #2  
Old October 15th, 2003, 12:46 PM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 13 m 21 sec
Reputation Power: 76
1. Java != javascript, for future reference
2. Javascript is a client-side language, ASP is server-side. The two can't interact. By the time your javascript is up and going, the asp code has already been processed on the server, and is finished.
If you desperately need to communicate between the two, both can set and read cookies, so you could use that, or use javascript to send some GET variables to an asp script.
However, you can get at least a good portion of what you're looking for with just asp. http://abstractvb.com/code.asp?F=5 has some code to get things like the referrer, and browser information (at least for .net).
HTH

Reply With Quote
  #3  
Old October 16th, 2003, 03:49 PM
Utopia's Avatar
Utopia Utopia is offline
superficial
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Peterborough, England
Posts: 188 Utopia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 36 m 8 sec
Reputation Power: 7
What you can do is render the javascript using ASP response.write's

Response.Write "<script>Alert('" & someASPVariable & "')</script>"

etc

I use these quite a lot to alert ACTUAL SQL statements before I actually execute them. Can be pretty useful.

Matt

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Passing java variables to 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


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT