ASPX page - ensure a task is done just once
Posted on 2003-03-22
I have an asp.net page written in C#. What I want to do is perform a certain task *once*, i.e. when a user first views a page on my site, and not do that task again whilst it is the same user or same browser window if you get me.
The purpose of my asp.net page is to simply log information about who visits my site and what page they look at (this is for statistical analysis), then redirects the user to the appropriate page within my site.
The *first time* someone visits my site however I want to recieve an email (yes I know it may sound sad) informing me of this. But since it is the same asp.net script that is runs each time a user requests a page, I do not want to be recieving an email for every page they look at !
So how can I achieve this ? I have read about Sessions and Cookies but do not know which is better.
I also think I may have problems with the Session object as I am requesting pages over two different web servers: the asp.net script is on a different server to the actual site content (images and html).
Can someone give me advice and/or code please ??
Thanks in advance.