473,387 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

checking whether browser allows cookies in asp.net

Can you check whether a users browser allows you to use cookies?

Cheers

Ollie
Nov 18 '05 #1
3 1340
if Request.Browser.Cookies = True

"Ollie" <ol**********@hotmail.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
Can you check whether a users browser allows you to use cookies?

Cheers

Ollie

Nov 18 '05 #2
WL
I assumt his test (just like when testing whether JavaScript is supported)
only checks whether the browser used SUPPORTS cookies (although they might
have been disabled by the user) ?

If so: the only real way of testing is by a multistep process sending a
cookie and then trying to read it back.

Wim
"Jared" <VB***********@email.com> wrote in message
news:10*************@corp.supernews.com...
if Request.Browser.Cookies = True

"Ollie" <ol**********@hotmail.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
Can you check whether a users browser allows you to use cookies?

Cheers

Ollie


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date: 22/07/04
Nov 18 '05 #3
Sub Page_Load()
If Not Page.IsPostBack Then
If Request.QueryString("AcceptsCookies") Is Nothing Then
Response.Cookies("TestCookie").Value = "ok"
Response.Cookies("TestCookie").Expires = _
DateTime.Now.AddMinutes(1)
Response.Redirect("TestForCookies.aspx?redirect=" & _
Server.UrlEncode(Request.Url.ToString))
Else
labelAcceptsCookies.Text = "Accept cookies = " & _
Request.QueryString("AcceptsCookies")
End If
End If
End Sub
SOURCE: MSDN
© Microsoft Corporation. All rights reserved.
"Ollie" <ol**********@hotmail.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
Can you check whether a users browser allows you to use cookies?

Cheers

Ollie

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrew Duffy | last post by:
Hi, I just want to check that i'm not going crazy.. I want to check whether or not a cookie has already been set and so I am using the following code. cookieValue = Request.Cookies("CartID")...
0
by: Lucifer | last post by:
Hi I have some code for checking for cookies, that sets a cookie on page1 and checks for it on page2. and its based on the code by MS: ...
4
by: | last post by:
I have heard there is something called a 'virtual browser' which allows me to check asp and html output on the complete range of browsers without having to download each browser and version (side...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
2
by: CES | last post by:
I'm sorry for the 101 question but I can't seem to get this to work... I'm tiring to test if a cookie has been created before. Everything I've seen indicates that Request.Cookies works the same...
9
by: SHarris | last post by:
Hello, In our new intranet ASP.NET project, two requirements are that the browser accept cookies AND JavaScript. We are requiring the use of Internet Explorer 6+. 1. Using C# in an ASP.NET...
1
by: Tina | last post by:
When I use Request.Browser.Cookies I always get true returned. Even when the browser has cookie acceptance turned off. Why? Thanks, T
2
by: tshad | last post by:
I was looking at different ways of doing the same thing and at the moment was looking at the use of "is" and "=", as I have at times found that I will do something like if something = 0 and...
4
by: Jeff | last post by:
I have a vb.net application (2005) requiring session variables and want to test to make certain that the user's cookies are enabled. I can set a test session variable on one page and attempt to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.