1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

cookies issue ASP

Discussion in 'C#' started by yuribar, Dec 26, 2005.

  1. #1
    I have been trying to resolve issue with setting cookies for 3 days and haven’t figured out this problem yet. Please help if you see any solution.

    Here is the issue:


    Domain1.com has file1.asp and file2.asp

    File1.asp:
    --------------------------------------------------------------------------
    <html>
    <body>
    .
    .
    .
    </body>
    <img src=”http://www.Domain2.com/stats/statistics.asp">
    </html>
    ---------------------------------------------------------------------------
    File2.asp:
    --------------------------------------------------------------------------
    <html>
    <body>
    .
    .
    .
    </body>
    <img src=”http://www.Domain2.com/stats/statistics.asp">
    </html>





    Domain2.com has stats/statistics.asp

    statistics.asp:
    --------------------------------------------------------------------------
    <%
    .
    .
    .
    VisitorID = 1000000
    Accounted = “test”

    if Request.Cookies(accountID & "_VisitorID")<>"" then
    VisitorID = Request.Cookies(accountID & "_VisitorID")
    else
    set rs=conn.execute("SELECT MAX(VisitorID) as mVisitorID FROM tb_loger")
    if rs("mVisitorID")<>"" then
    VisitorID = rs("mVisitorID")+1
    end if
    end if

    ‘tt=DateAdd("m", 24, Now())
    tt = Date() + 300
    Response.Cookies(accountID & "_VisitorID") = VisitorID
    Response.Cookies(accountID & "_VisitorID").Expires = tt

    ---------------------------------------------------------------------

    The idea is to keep track of visitor ID while visitor goes from file1 to file2
    on Domain1.com by setting cookies by Domain2.com

    This works fine on Mazilla Firefox but not with IE 6.0
    It seems like the cookie expires each time before it goes to the next page (from file1.asp to file2.asp) . The cookie loos the value and new VisitorID is being generated.

    Any help is appreciated. Other approaches is fine but it has to be different domains (statistics.asp and file1,file2)

    I'm desperate, please help
     
    yuribar, Dec 26, 2005 IP
  2. pratik

    pratik Notable Member

    Messages:
    2,303
    Likes Received:
    114
    Best Answers:
    0
    Trophy Points:
    200
    #2
    pratik, Dec 26, 2005 IP
  3. adbie

    adbie Peon

    Messages:
    149
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i think a better way is to make statistics.asp emit javascript that writes cookies used for tracking. in file1.asp/file2.asp, you'll need a line like the following to embed the script generated from your 2nd domain:
    <script src="http://...statistics.asp></script>

    many trackers use a similar technique.
     
    adbie, Dec 26, 2005 IP