<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>Scott Elkin &#187; cookies</title> <atom:link href="http://scottelkin.com/tag/cookies/feed/" rel="self" type="application/rss+xml" /><link>http://scottelkin.com</link> <description>Tech, Love, Life</description> <lastBuildDate>Thu, 07 Apr 2011 23:02:52 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Nasty IIS/ASP Querystring Cookie Case Bug</title><link>http://scottelkin.com/programming/nasty-iisasp-querystring-cookie-case-bug/</link> <comments>http://scottelkin.com/programming/nasty-iisasp-querystring-cookie-case-bug/#comments</comments> <pubDate>Fri, 29 Feb 2008 20:53:23 +0000</pubDate> <dc:creator>Scott</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[ASP]]></category> <category><![CDATA[bug]]></category> <category><![CDATA[cookies]]></category> <category><![CDATA[IIS]]></category><guid isPermaLink="false">/archive/2008/02/29/Nasty-IIS_2F00_ASP-Querystring-Cookie-Case-Bug.aspx</guid> <description><![CDATA[I just stumbled on a nasty, nasty ASP bug that took about 7 years for me to see. The problem happens when using cookies and querystrings with the same name. A page on the site reads in a variable from the querystring and sets a cookie with the same name to its value, e.g.: strSrc [...]No related posts.]]></description> <content:encoded><![CDATA[<p>I just stumbled on a nasty, nasty ASP bug that took about 7 years for me to see.</p><p>The problem happens when using cookies and querystrings with the same name. A page on the site reads in a variable from the querystring and sets a cookie with the same name to its value, e.g.:</p><p>strSrc = Request.QueryString(&#8220;A&#8221;)<br /> Response.Cookies(&#8220;A&#8221;) = strSource<br /> Response.Cookies(&#8220;A&#8221;).Expires = Now + (2 * 30)</p><p>However, if the variable name in the query string is different from the capitalization of the cookie name (e.g page.asp?a=xxx) then a new cookie gets set with the name matching the captialization of the<br /> QueryString variable.</p><p>So if you run the page multiple ways, a=123 and A=123, two different cookies are set EVEN THOUGH YOUR CODE SAYS Response.Cookies(&#8220;A&#8221;) = strSource!</p><p>Attempting to read the cookie value back then returns both values. Reading the cookie value via Request.ServerVariables(&#8220;HTTP_COOKIE&#8221;) shows both values.</p><p>If your code is looking for the “A” cookie later on and there are two cookes there, you will only see the “A” one, which may not be the one you want.</p><p>Since I ran into this, I did see other complain about this as far back as 2003: <a href="http://groups.google.com/group/microsoft.public.inetserver.iis.activeserverpages/browse_thread/thread/805b953bc0e3ad01/3ae60f69dcd6120f?lnk=st&amp;q=asp+iis+querystring+cookie+bug#3ae60f69dcd6120f">here</a>, <a href="http://groups.google.com/group/microsoft.public.inetserver.asp.general/browse_thread/thread/872afab97238cf11/2088dbb3f112b609?lnk=st&amp;q=asp+iis+querystring+cookie+bug#2088dbb3f112b609">here</a>, <a href="http://groups.google.com/group/microsoft.public.inetserver.asp.general/browse_thread/thread/872afab97238cf11/706ae11109ee699a?lnk=st&amp;q=asp+iis+querystring+cookie+bug#706ae11109ee699a">here</a>.</p><div class="bjtags">Tags: <a rel="tag" href="http://technorati.com/tag/ASP">ASP</a>, <a rel="tag" href="http://technorati.com/tag/IIS">IIS</a>, <a rel="tag" href="http://technorati.com/tag/programming">programming</a>, <a rel="tag" href="http://technorati.com/tag/cookies">cookies</a>, <a rel="tag" href="http://technorati.com/tag/querystring">querystring</a>, <a rel="tag" href="http://technorati.com/tag/bug">bug</a>, <a rel="tag" href="http://technorati.com/tag/microsoft">microsoft</a></div><p>No related posts.</p>]]></content:encoded> <wfw:commentRss>http://scottelkin.com/programming/nasty-iisasp-querystring-cookie-case-bug/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: scottelkin.com @ 2012-02-05 11:48:08 -->
