Author |
Topic  |
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 01 December 2004 : 16:27:21
|
quote: Originally posted by Tiggerz
http://www.w3schools.com/asp/asp_cookies.asp
At the very top its says Response.Cookies must appear before the html tag.
I don't know why they would state that unless they're doing it for explicit reasoning, but I am telling you once again, it does NOT have to be. Did you even try my test? I already proved the point about the cookie issue.
I'd love to see the script you're having problems with. I'm willing to bet there is something else causing your problem. |
|
Edited by - dayve on 01 December 2004 16:42:17 |
 |
|
Tiggerz
Starting Member
45 Posts |
Posted - 01 December 2004 : 18:20:06
|
yes, I tried your test - it didnt work. I just got a property ready only error on the bit where you assign a value to the cookie.
For me I can only do ("mycookie")("field") = aValue If I try and do ("mycookie") = aValue I get a read only error.
When I change it to the line that works, I get no value from Request.Cookies and Response.Cookies does not save a value if I readload the page). |
Edited by - Tiggerz on 01 December 2004 18:23:47 |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 01 December 2004 : 18:26:11
|
It's your server and/or client settings.
What browser are you using? Have you tried another browser besides your default one. What hosting company are you using? |
|
 |
|
Tiggerz
Starting Member
45 Posts |
Posted - 01 December 2004 : 23:41:26
|
IE 6.x IIS 5 winxp sp2, .net 2k3 local machine. vb script 2.5
That issue is mentioned on quite a few forums if you google for it as well as WC3. |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 01 December 2004 : 23:43:21
|
doesn't matter... the problem is only happening with you. I've used and tested using cookies many times over on different machines and never had a problem like you're describing. if you post your script I assure you I can get it working without putting the cookie info before the html tag. |
|
 |
|
Tiggerz
Starting Member
45 Posts |
Posted - 02 December 2004 : 01:24:25
|
Its working now :)
So why would W3C post up an issue that I was duplicating if its not true. |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 02 December 2004 : 05:32:29
|
maybe to try to prevent these problems - if your buffering is (programatically/serversideically) set to FALSE then you would get the errors you are seeing whereas dayve wouldn't necessarily if his was set to TRUE.
As the data has to be passed in the header, and w3c define the standards of HTML then saying the cookie should be sent before the <html> tag is true, and it is a feature of IIS (and other servers by the sounds of it) that they will buffer and so allow the cookie value to be set anywhere in the page. However, to be on the safe side (maybe you decide to take your app and convert it to python and run it on a myfreewarelinuxcompatiblebasicasallheckwebserver) follow the standards, set the cookie before the <html> tag, and your code will be standards-compliant and more robust and supported because of it.
Anyone disagree? There are both gains and risks developing for version-specific extensions to protocols, so where possible, follow the standard. IMVHO, of crs  |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 02 December 2004 : 11:34:14
|
my server settings are not tweaked so everything is in a default fashion. I am not disagreeing where a response.cookie should be placed, I am merely stating that it can be done. W3C standards does not mean it is law. Internet Explorer has proven otherwise that things work when they should not. Heck... people still use HTML tags incorrectly and their sites still work.
my point was, and still stands, that Tiggerz issue is a matter of server/client settings OR other code portions in his script preventing him from doing what he wanted to do. I'd still love to see the script he is having difficulty with. |
|
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 03 December 2004 : 06:24:50
|
yeah - would be interesting to get to the bottommost bit of this one! |
 |
|
Tiggerz
Starting Member
45 Posts |
Posted - 04 December 2004 : 02:34:46
|
I suspect that it is a server setting, because just thinking I have javascript code that uses cookies all over the place and I dont ever remember having to do it before the html tag. Being the script code is running on the same server that this vbscript code is running, I suspect its more to do with a server side asp setting rather than anything else.
|
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 04 December 2004 : 11:53:45
|
Tiggerz... post your code in a text file and I'm sure we can pinpoint something, otherwise we can do nothing but continue to speculate as to the cause of the problem. |
|
 |
|
Tiggerz
Starting Member
45 Posts |
Posted - 04 December 2004 : 16:47:10
|
its working now.
If you google on the term 'asp cookies before html' then you will find out why it needs to be done before the html tag. But in general its because the cookie collection is written out to the client with the headers. Hence before the <html> tag as that sends the header.
I suspect you could do it after, but you'd need to send out more headers (a redirect would do that). |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 04 December 2004 : 23:07:25
|
I know it's working, I just want to see what your coding lookes like so I can give some advice. |
|
 |
|
Tiggerz
Starting Member
45 Posts |
Posted - 04 December 2004 : 23:59:40
|
I used your code example, but just moved the response.cookies b4 the html tag. Your example doesnt actually create a cookie file on disk, which is what I was on about. It just updates memory.
|
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 05 December 2004 : 01:26:25
|
again, if you would show your code... ahh, forget it. you're missing the point. |
|
 |
|
Topic  |
|