Yes, ADP is the "simple" way of doing things that takes care of all this
stuff for you. I never use .tcl pages. The only time I use "raw" Tcl is
with a registered procedure, so I can have a pretty url like
"/news/123.html" rather than "news.adp?id=123"

Cheers,
Bas.

Thorpe Mayes said:
> Okay. I think I see now. When using tcl, I have to do something that
> will send some headers. I added an ns_return ... and it worked.
>
> So does adp send headers in all instances?
>
> Thank you for your help.
>
> Thorpe
>
> On Sep 23, 2005, at 8:37 AM, Bas Scheffers wrote:
>
>> I think that the first ns_write will send the headers. If you don't
>> have
>> ANY ns_writes, headers don't get sent at all. If I recall correctly...
>>
>> Thorpe Mayes said:
>>> It still does not work. Specifically, the .adp file will set a cookie,
>>> but the .tcl file will not.
>>>
>>> I simplified the code to the following:
>>>
>>> --------
>>> adp:
>>>
>>> <%
>>> set host [string tolower [ns_set get [ns_conn headers $conn] Host]]
>>>
>>> set jar [ns_getallcookies $conn]
>>>
>>> ns_setcrumble jar userinfo hits 100
>>>
>>> ns_setcrumble jar userinfo lastvisit [ns_time]
>>>
>>> set path "/ritarims/"
>>>
>>> ns_sendcookie $conn $jar userinfo $path [expr [ns_time] + 31536000]
>>> "$host" ""
>>>
>>> %>
>>>
>>>
>>> ---------
>>> tcl:
>>>
>>> set host [string tolower [ns_set get [ns_conn headers $conn] Host]]
>>>
>>> set jar [ns_getallcookies $conn]
>>>
>>> ns_setcrumble jar userinfo hits 100
>>>
>>> ns_setcrumble jar userinfo lastvisit [ns_time]
>>>
>>> set path "/ritarims/"
>>>
>>> ns_sendcookie $conn $jar userinfo $path [expr [ns_time] + 31536000]
>>> "$host" ""
>>>
>>> --------
>>>
>>>
>>> On Sep 23, 2005, at 6:20 AM, Bas Scheffers wrote:
>>>
>>>> It doesn't work becuase your ns_writes will already have sent the
>>>> headers.
>>>> So your ns_sendcookie that adds them to the headers isn't getting
>>>> sent
>>>> anymore.
>>>>
>>>> In the ADP version, nothing is sent before the page is complete, as
>>>> streaming isn't turned on, which is qhy it works.
>>>>
>>>> Send your cookies before any ns_writes in the Tcl version.
>>>>
>>>> Cheers,
>>>> bas.
>>>>
>>>> Thorpe Mayes said:
>>>>> Why does this adp code work:
>>>>>
>>>>> -----------------
>>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>>>>> <HTML>
>>>>> <BODY>
>>>>> <%
>>>>>
>>>>>   set host [string tolower [ns_set get [ns_conn headers $conn]
>>>>> Host]]
>>>>>
>>>>>   set jar [ns_getallcookies $conn]
>>>>>   set hits [ns_getcrumble $jar userinfo hits]
>>>>>   set lastvisit [ns_getcrumble $jar userinfo lastvisit]
>>>>>
>>>>>   if { [string match "" $hits] } {
>>>>>     set hits "0"
>>>>>   }
>>>>>   incr hits
>>>>>
>>>>>   ns_puts "Hits: $hits<br>"
>>>>>
>>>>>   if { [string match "" $lastvisit] } {
>>>>>     ns_puts "Last Visit: This is your first visit, yay!!!!<br>"
>>>>>   } else {
>>>>>     ns_puts "Last Visit: [ns_fmttime $lastvisit "%a, %d-%b-%Y %T
>>>>> GMT"]<br>"
>>>>>   }
>>>>>
>>>>>   ns_setcrumble jar userinfo hits $hits
>>>>>   ns_setcrumble jar userinfo lastvisit [ns_time]
>>>>>
>>>>>   ns_sendcookie $conn $jar userinfo "/" [expr [ns_time] + 31536000]
>>>>> "$host" ""
>>>>>
>>>>> %>
>>>>>
>>>>> </BODY>
>>>>> </HTML>
>>>>>
>>>>> --------
>>>>>
>>>>> but this tcl code not work:
>>>>>
>>>>> ----------
>>>>>
>>>>> set host [string tolower [ns_set get [ns_conn headers conn] Host]]
>>>>>
>>>>> set jar [ns_getallcookies $conn]
>>>>>
>>>>> set hits [ns_getcrumble $jar userinfo hits]
>>>>>
>>>>> set lastvisit [ns_getcrumble $jar userinfo lastvisit]
>>>>>
>>>>> if { [string match "" $hits] } {
>>>>>     set hits "0"
>>>>> }
>>>>>   incr hits
>>>>>
>>>>>   ns_write "Hits: $hits\n\n"
>>>>>
>>>>> if { [string match "" $lastvisit] } {
>>>>>
>>>>>     ns_write "Last Visit: This is your first visit, yay!!!!"
>>>>>
>>>>> } else {
>>>>>     ns_write "Last Visit: [ns_fmttime $lastvisit "%a, %d-%b-%Y %T
>>>>> GMT"]"
>>>>> }
>>>>>
>>>>>   ns_setcrumble jar userinfo hits $hits
>>>>>
>>>>> ns_setcrumble jar userinfo lastvisit [ns_time]
>>>>>
>>>>> ns_sendcookie conn $jar userinfo "/" [expr [ns_time] + 31536000]
>>>>> $host ""
>>>>>
>>>>> -----
>>>>>
>>>>> ?
>>>>>
>>>>> the tcl code does not save the cookie while the adp code does.
>>>>>
>>>>> I am running aolserver 3.5.6
>>>>>
>>>>> the ns_ procedures are in cookie.tcl
>>>>>
>>>>> Thank you.
>>>>>
>>>>> Thorpe
>>>>>
>>>>>
>>>>> --
>>>>> AOLserver - http://www.aolserver.com/
>>>>>
>>>>> To Remove yourself from this list, simply send an email to
>>>>> <[EMAIL PROTECTED]> with the
>>>>> body of "SIGNOFF AOLSERVER" in the email message. You can leave the
>>>>> Subject: field of your email blank.
>>>>>
>>>>
>>>>
>>>> --
>>>> AOLserver - http://www.aolserver.com/
>>>>
>>>> To Remove yourself from this list, simply send an email to
>>>> <[EMAIL PROTECTED]> with the
>>>> body of "SIGNOFF AOLSERVER" in the email message. You can leave the
>>>> Subject: field of your email blank.
>>>>
>>>>
>>> Thorpe Mayes
>>> eCognizant LLC
>>> 3840 Cobble Circle
>>> Norman, Oklahoma 73072
>>> (405) 514-9753
>>> (800) 309-5832
>>> fax: 1-866-871-3069
>>> [EMAIL PROTECTED]
>>>
>>>
>>> --
>>> AOLserver - http://www.aolserver.com/
>>>
>>> To Remove yourself from this list, simply send an email to
>>> <[EMAIL PROTECTED]> with the
>>> body of "SIGNOFF AOLSERVER" in the email message. You can leave the
>>> Subject: field of your email blank.
>>>
>>
>>
>> --
>> AOLserver - http://www.aolserver.com/
>>
>> To Remove yourself from this list, simply send an email to
>> <[EMAIL PROTECTED]> with the
>> body of "SIGNOFF AOLSERVER" in the email message. You can leave the
>> Subject: field of your email blank.
>>
>>
> Thorpe Mayes
> eCognizant LLC
> 3840 Cobble Circle
> Norman, Oklahoma 73072
> (405) 514-9753
> (800) 309-5832
> fax: 1-866-871-3069
> [EMAIL PROTECTED]
>
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <[EMAIL PROTECTED]> with the
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the
> Subject: field of your email blank.
>


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to