473,811 Members | 3,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1359
if Request.Browser .Cookies = True

"Ollie" <ol**********@h otmail.com> wrote in message
news:ec******** ******@TK2MSFTN GP10.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.supe rnews.com...
if Request.Browser .Cookies = True

"Ollie" <ol**********@h otmail.com> wrote in message
news:ec******** ******@TK2MSFTN GP10.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.QuerySt ring("AcceptsCo okies") Is Nothing Then
Response.Cookie s("TestCookie") .Value = "ok"
Response.Cookie s("TestCookie") .Expires = _
DateTime.Now.Ad dMinutes(1)
Response.Redire ct("TestForCook ies.aspx?redire ct=" & _
Server.UrlEncod e(Request.Url.T oString))
Else
labelAcceptsCoo kies.Text = "Accept cookies = " & _
Request.QuerySt ring("AcceptsCo okies")
End If
End If
End Sub
SOURCE: MSDN
© Microsoft Corporation. All rights reserved.
"Ollie" <ol**********@h otmail.com> wrote in message
news:ec******** ******@TK2MSFTN GP10.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
1783
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") 'if cookie hasn't already been set, then set it! If cookieValue = "" Then
0
333
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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchaspnetcookies101.asp under section: 'Checking Whether a Browser Accepts Cookies' This code works great, when its in my development enviroment.
4
3676
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 by side)....I did a google search and see a variety of links but nothing conclusive. Is there a standard product experienced asp developers are using..can you point me towards it? What are the limitations and challenges in using this product?
67
4290
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. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
2
2031
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 in .net as it did in old asp but for some reason I'm getting "System.NullReferenceException: Object reference not set to an instance of an object" when ever I attempt to test for the cookie . It doesn't return an error if the cookie exists but...
9
3062
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 application, how can we code the project to check to make sure the browser accepts cookies? 2. Where would we put this code? In Global.asax? 3. Using C# in an ASP.NET application, how can we code the project to detect and make sure the browser...
1
1118
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
1178
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 will get an error that says I can't use "=" (or <>) in this case case I must use "is" ( or not something is). I am trying to find out when this is the case - when I can use the "=" and when I have to use "is.
4
4053
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 read it on the next with the code below in order to determine if the user has their browser's cookies enabled, but is there a good way to do this on the first/default page without a redirect to another page that will actually do the test? Thanks
0
9730
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.