Title: Avoiding cookies while requesting static content
Tags: asp.net;cookies;webserver
Question: I just did an audit of one of my web application page (built using ASP.Net and running on development server) using Google chrome's developer tool. One particular warning caught my eyes:
Serve static content from a cookieless domain (5)!
I would like to know is it possible to avoid cookies for these kind of requests. I see that there is no cookie requests for javascript files as well. I  it possible to avoid cookies in the header for these files as well? and why didn't the browser attach cookies for javascript files and attach for CSS and image?
Comment: Could you fix the image, or remove the link?

Here is the accepted answer: Cookie are "attached" to a domain and a path. If you set cookies for a path above your files, they'll be sent with any request for those files.
The warning message itself tells you how to fix this - use another domain for your static content. Or a subdomain, as long as you make sure you keep your main domain cookieless in that case.
Comment for this answer: @Abdel: Perhaps the tool missed those requests. Got a link to the page in question so I could see for myself?
Comment for this answer: yes, I understood that the solution is to move the files to a cookieless domain. What I need to know is why cookies did not get attached to javascript files during the request and only to css and image?
Comment for this answer: unfortunately no.. let me check again if the tool missed them out

Here is another answer: The easiest thing to do is to follow the exact suggestion in the warning message you pasted in (serve your static assets from a completely different hostname on which you don't set cookies). But in modern browsers you now also have the option of setting the crossorigin=&quot;anonymous&quot; attribute on the relevant elements, which will prevent cookies from being sent for the matching requests. You will need to combine this with returning an access-control-allow-origin: YOUR-ORIGIN-HERE.com header in your static asset responses.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2010:00:05/31/10', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<asp.net><cookies><webserver>', 'Title': 'Avoiding cookies while requesting static content', 'ViewCount': 2558, 'id': 2943489, 'user_AboutMe': '<p>A Web enthusiast, who loves working on .NET and JavaScript. Over 14 years of experience with Web technologies, solution architecture and consulting.</p>\n', 'user_AccountId': 62487.0, 'user_DisplayName': 'Abdel Raoof Olakara', 'user_Reputation': 18995.0, 'user_Views': 2246.0, 'user_id': 185655.0}}