I need to display a message if the user has cookies disabled. How would I go about doing this?
The only way is to store a value in cookie and check if you get the value back.
Save some test value and try to re-read it at the next request.
But honestly, your approach is not user friendly. There is hardly any technical reason to deny a service with cookies disabled. You can fall gracefully and just store the values in session.
Anyway, if a user has "In-private" browsing mode on (now available in both IE & FF meaning almost all users) your cookies will anyway be gone after the user's done and there is no way you can detect the "in-private" mode.
You can check the Request.Cookies
property which would return an empty HttpCookieCollection
.
In Javascript, the usual way to check is the Navigator.cookieEnabled property (works on IE, for other browsers, I think you need to set a cookie and try to read back its value).