473,671 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remote Counter,

Hello Group,

I have been playing with this idea for a month or so, but never really got
anywhere....

I want to make a remote counter image, the same as is found on
mycounter.com, where people have have an IMG SRC on there page which will
increment a SQL counter on my database.

so each time there page is loaded, it get the image from my site, but also
increments a hit counter on SQL..

I have really no idea how to do this, however I need to try and do this is
ASP, not CGI or anything like that, as I will never understand it :-)

what I have tryed so far is streaming the image which I can do, but I dont
know how to pass the varable from the IMG SRC to the server..

I know this is not the answer but I want to try and do something like this

how can I pass the for example ?ID=123 value to be grabbed in the page on my
site
<img border="0"
="http://www.mysite.com/counters/index.asp?id=12 3"> ----------- on remote
site
<============ WITH THIS CODE ON MY SITE======(inde x.asp)=======>
response.conten ttype="image/gif"
response.binary write getBinaryFile(s erver.mappath(" ../images/car.jpg"))

' ////////// how can I grab the value of the ID on the remote IMG SRC
response.write querystring("id ")
' /////////////////////////////////////////////////////////////////////////

function getBinaryFile(f ileSpec)

Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createob ject("ADODB.Str eam")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFro mFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

If I have gone on totally the wrong track, any other ideas would be very
very welcome, as I need to get something running asap..
Kind Regards

Graham Mattingley
Jul 19 '05 #1
5 2140
Do it all server side first, then find out the value in your DB and place
that into a variable and use that to display the image.

This may help:-

intCount = 123 'Value from db after it has been incremented
For i = 1 to (6 - (Len(intCount)) )
Response.Write ("<img src=""/images/ado/dg0.gif"">")
Next
For i = 1 to Len(intCount)
Response.Write ("<img src=""/images/ado/dg")
Response.Write Mid(intCount, i, 1)
Response.Write (".gif"">")
NEXT

Hope this helps

Stu

"Graham Mattingley" <gr****@technoc om.com> wrote in message
news:bv******** ***********@new s.demon.co.uk.. .
Hello Group,

I have been playing with this idea for a month or so, but never really got
anywhere....

I want to make a remote counter image, the same as is found on
mycounter.com, where people have have an IMG SRC on there page which will
increment a SQL counter on my database.

so each time there page is loaded, it get the image from my site, but also
increments a hit counter on SQL..

I have really no idea how to do this, however I need to try and do this is
ASP, not CGI or anything like that, as I will never understand it :-)

what I have tryed so far is streaming the image which I can do, but I dont
know how to pass the varable from the IMG SRC to the server..

I know this is not the answer but I want to try and do something like this

how can I pass the for example ?ID=123 value to be grabbed in the page on my site
<img border="0"
="http://www.mysite.com/counters/index.asp?id=12 3"> ----------- on remote site
<============ WITH THIS CODE ON MY SITE======(inde x.asp)=======>
response.conten ttype="image/gif"
response.binary write getBinaryFile(s erver.mappath(" ../images/car.jpg"))

' ////////// how can I grab the value of the ID on the remote IMG SRC
response.write querystring("id ")
' /////////////////////////////////////////////////////////////////////////
function getBinaryFile(f ileSpec)

Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createob ject("ADODB.Str eam")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFro mFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

If I have gone on totally the wrong track, any other ideas would be very
very welcome, as I need to get something running asap..
Kind Regards

Graham Mattingley

Jul 19 '05 #2
Graham Mattingley wrote on 31 jan 2004 in
microsoft.publi c.inetserver.as p.general:
<img border="0"
="http://www.mysite.com/counters/index.asp?id=12 3"> ----------- on
remote site
src =

Not on a remote site, but just clientside code in an asp or html file on
your site
<============ WITH THIS CODE ON MY SITE======(inde x.asp)=======>
<%
if request.queryst ring("id")="123 " then
'increment your counter in a database or txt-file
n = getTheNumber("f ile123")
n = n+1
storeTheNumber( "file123",n )
end if
%>
response.conten ttype="image/gif"
why, if it is jpeg, specify gif ?
response.binary write
getBinaryFile(s erver.mappath(" ../images/car.jpg"))


There is a bit more to it, you have to fetch the file, addheader etc.
<>

or you could just do [not tested]:

response.conten ttype="image/jpeg"
server.transfer "../images/car.jpg"

or [perhaps]

response.conten ttype="image/jpeg" %>
<!--#include virtual="../images/car.jpg" -->

as long as this image has no "<%" in its binary stream,
in wich seldom case you will find that the image is not rendered as
expected. Your response.binary write solution is a safer but more coding
intensive solution.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3
If you manage to find a way to do this, I'd love to see it (been trying to
figure it out myself for a couple months and not been able to find anything
useful)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Graham Mattingley <gr****@technoc om.com> wrote in message
news:bv******** ***********@new s.demon.co.uk.. .
Hello Group,

I have been playing with this idea for a month or so, but never really got
anywhere....

I want to make a remote counter image, the same as is found on
mycounter.com, where people have have an IMG SRC on there page which will
increment a SQL counter on my database.

so each time there page is loaded, it get the image from my site, but also
increments a hit counter on SQL..

I have really no idea how to do this, however I need to try and do this is
ASP, not CGI or anything like that, as I will never understand it :-)

what I have tryed so far is streaming the image which I can do, but I dont
know how to pass the varable from the IMG SRC to the server..

I know this is not the answer but I want to try and do something like this

how can I pass the for example ?ID=123 value to be grabbed in the page on my site
<img border="0"
="http://www.mysite.com/counters/index.asp?id=12 3"> ----------- on remote site
<============ WITH THIS CODE ON MY SITE======(inde x.asp)=======>
response.conten ttype="image/gif"
response.binary write getBinaryFile(s erver.mappath(" ../images/car.jpg"))

' ////////// how can I grab the value of the ID on the remote IMG SRC
response.write querystring("id ")
' /////////////////////////////////////////////////////////////////////////
function getBinaryFile(f ileSpec)

Dim adTypeBinary
adTypeBinary = 1
Dim oStream
set oStream = server.createob ject("ADODB.Str eam")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFro mFile fileSpec
getBinaryFile= oStream.read
set oStream=nothing
end function

If I have gone on totally the wrong track, any other ideas would be very
very welcome, as I need to get something running asap..
Kind Regards

Graham Mattingley

Jul 19 '05 #4
Steven Burn wrote on 31 jan 2004 in
microsoft.publi c.inetserver.as p.general:
If you manage to find a way to do this, I'd love to see it (been
trying to figure it out myself for a couple months and not been able
to find anything useful)


<http://www.4guysfromro lla.com/webtech/code/hitcounter.asp. html>

<http://www.4guysfromro lla.com/webtech/041801-1.shtml>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5
I already know how to write a local one, just not one that supports multiple
remote clients.

I'll give the a looksee though and see if they help..... cheers ;o)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Evertjan. <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
Steven Burn wrote on 31 jan 2004 in
microsoft.publi c.inetserver.as p.general:
If you manage to find a way to do this, I'd love to see it (been
trying to figure it out myself for a couple months and not been able
to find anything useful)


<http://www.4guysfromro lla.com/webtech/code/hitcounter.asp. html>

<http://www.4guysfromro lla.com/webtech/041801-1.shtml>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
29108
by: Jay | last post by:
I need to write a program to find mac address of a remote computer, is this possible? How?
0
1531
by: Christopher Attard | last post by:
Hi, I'm using the PerformanceCounter .NET class to obtain the "% Processor Time" for processes that are running on a remote host. These processes are obtained using the System.Diagnostics.Process.GetProcesses(host) method. I'm noticing that for some running processes, the program is throwing out an exception "Cannot read instance :<processname>". Is this a known issue or could it be solved? For e.g. on getting "% Processor Time"...
0
1229
by: Frank Rosario | last post by:
Hello all; in need of some assistance. I am currently writing some software for our companies intranet, and I need for it to specifically access other machines on the network's Performance counters. Now I ran all the code against my machine and I can access the counter information fine. But if I try to create a counter on a remote machine I get an access denied error; obviously a permissions based issue. Now I tried setting the assemblies...
0
1152
by: gmcelhanon | last post by:
I have some code that attempts to read a performance counter on a remote machine. Under .NET 1.1 the code works just fine, but under ..NET 2.0 I get a SecurityException with a description of "Requested registry access is not allowed". Everything about the code and target machines is the same, with the only difference being that I'm running the code under a brand new installation of VS.NET 2005. As for security, I am a member of an AD...
3
4588
by: Geoff McElhanon | last post by:
I have been struggling with a security issue that occurs under .NET 2.0, but does not occur under .NET 1.1. Essentially I am trying to open up a performance counter on a remote server and monitor its value. In .NET 1.1 this worked fine, however under .NET 2.0 it fails when I am not an administrator on the remote server. To provide a lean demonstration of the issue, I created the following class: ============================
4
4806
by: Abhi | last post by:
Hi All, I have a web service method which works fine when called from my local machine i.e. from localhost but when I publish the web services to a remote machine it throws an invalid cast soap exception. That web service method access Active Directory to get the group names for the given user. Following is the code. DirectorySearcher dirSearcher = new DirectorySearcher();
15
7069
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter every second. I remote desktop to the computer hosting this application and run the application. It starts up and displays the counter incrementing every second. If I disconnect the network cable between the two computers for 10 seconds and...
1
1345
by: grif | last post by:
Hey Everyone! Ok time for another newbie question from me...I've written a little program that reads URL's from a text file line by line and then does a POST action etc The problem is that the program gets an exception and terminates when a remote server gives an error like....method not allowed etc Any ideas how or what I can use to avoid it terminating the program completely???
11
5418
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Has anybody worked with performancecounter object to access counters on remote machine? I managed to write code that retrieves counters categories froma remote machine, when I try another remote machine I get "System.ComponentModel.Win32Exception" error. Error message is "The network path was not found." I have checked running services (RPC, Remote registery.....) on both machines and they are exactly the same. I am wondering if there is...
0
8483
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8927
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8825
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.