BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Comma Delimited Cookies in ASP.NET with Parser Tool

| by Anand Narayanaswamy Follow 0 Followers on Nov 03, 2012. Estimated reading time: less than one minute |

ASP.NET does not provide support for comma delimited cookes which you will realize if you examine the source code for System.Web.HttpRequest class. You have to make use of semicolon charcter to work with cookies.

However, HTTP state management mechanism document of W3C (RFC2309) states that semicolon and comma are both valid characters to be used as a delimiter for cookie keys. But semicolon is commonly used by developers.

In order to implement comma delimited cookies in ASP.NET, you need to create a tool which simulates ASP.NET to parse cookies with comma instead of semicolon. The steps involved for the creation of a parser tool are as follows

  • Create HttpModule class that processes each and every request
  • Check for the existence of comma in cookie header
  • Parse and extract the cookies to put them in the collection

Keyvan Nayyeri, Software Engineer, Match.com has implemented the above mentioned steps in his parser tool. According to Keyvan, the parser tool does not work if comma is used in the value of cookies and developers will be able to test the module with Fiddler.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT