Hi,
I searched around everywhere on the net, but could not find a simple example
of detecting if cookies are enabled - on server side, and without moving
from one page to another.
This should be a very basic functionality, so I am reluctant to believe that
there's no way to simply test it in a server-side script.
Anyone?
Thx,
Agoston 9 7836
AFAIK no. You have to test this client side (it could be on the same page
depending on what exactly annoys you with client side methods).
Patrice
--
"Agoston Bejo" <gu***@freemail.hu> a écrit dans le message de
news:%2****************@TK2MSFTNGP10.phx.gbl... Hi, I searched around everywhere on the net, but could not find a simple
example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe
that there's no way to simply test it in a server-side script. Anyone?
Thx, Agoston
"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:#H**************@TK2MSFTNGP10.phx.gbl... Hi, I searched around everywhere on the net, but could not find a simple
example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe
that there's no way to simply test it in a server-side script. Anyone?
Thx, Agoston
"... detecting if cookies are enabled - on server side ..."
Are you asking how to detect if client-side cookies are enabled via
server-side ASP?
"Response.Cookies" is defined as "A collection containing the values of all
the cookies that will be sent back to the client in the current response.".
"Request.Cookies" is defined as A collection of the values of all the
cookies sent from the user's system along with their request."
Thus, I thought that this would work:
Response.Cookies("aCookie") = "Hello World"
Response.Write "Are client-side cookies enabled? = " & (Not
IsEmpty(Request.Cookies("aCookie")))
But it returned "True" even when Cookies were disabled.
McKirahan wrote on 10 feb 2005 in
microsoft.public.inetserver.asp.general: detecting if cookies are enabled - on server side, and without moving from one page to another.
But that is a silly expectation.
Thus, I thought that this would work:
Response.Cookies("aCookie") = "Hello World" Response.Write "Are client-side cookies enabled? = " & (Not IsEmpty(Request.Cookies("aCookie")))
But it returned "True" even when Cookies were disabled.
How do you expect the server knowing anything about the client,
without contacting the client?
You will have to resort to something like this:
1.asp:
<%
Response.Cookies("aCookie") = "Hello World"
Response.redirect "2.asp"
%>
2.asp:
<%
If Session("aCookie") = "Hello World" Then
Response.Write "Cookies Enabled"
Else
Response.Write "Cookies Disabled"
End If
%>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
The problem is that it works as a request/response pairs.
The client sends a request and you respond to this request. If you write
down cookies to the response, it will make them visible in the *next*
request, not in the request you respond to.
You'll have to use something similar to what Evertjan shows (there is a
typo, this Cookies not Session).
You could do it on the same page if this is really a problem with some query
string to know at which step you are...
Patrice
--
"McKirahan" <Ne**@McKirahan.com> a écrit dans le message de
news:bO********************@comcast.com... "Agoston Bejo" <gu***@freemail.hu> wrote in message news:#H**************@TK2MSFTNGP10.phx.gbl... Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe that there's no way to simply test it in a server-side script. Anyone?
Thx, Agoston
"... detecting if cookies are enabled - on server side ..."
Are you asking how to detect if client-side cookies are enabled via server-side ASP?
"Response.Cookies" is defined as "A collection containing the values of
all the cookies that will be sent back to the client in the current
response.". "Request.Cookies" is defined as A collection of the values of all the cookies sent from the user's system along with their request."
Thus, I thought that this would work:
Response.Cookies("aCookie") = "Hello World" Response.Write "Are client-side cookies enabled? = " & (Not IsEmpty(Request.Cookies("aCookie")))
But it returned "True" even when Cookies were disabled.
[...] detecting if cookies are enabled - on server side, and without moving from one page to another. But that is a silly expectation.
[...] How do you expect the server knowing anything about the client, without contacting the client?
Request.ServerVariables("HTTP_USER_AGENT")
By using this, you definitely get some information about the client on
server side. So I don't think that expectation is so silly. I accept that
about cookies you cannot get information this way, however.
Thanks anyway!
Agoston Bejo wrote on 12 feb 2005 in
microsoft.public.inetserver.asp.general: [...] > detecting if cookies are enabled - on server side, > and without moving from one page to another.
But that is a silly expectation.
[...] How do you expect the server knowing anything about the client, without contacting the client?
Request.ServerVariables("HTTP_USER_AGENT") By using this, you definitely get some information about the client on server side. So I don't think that expectation is so silly. I accept that about cookies you cannot get information this way, however.
Thanks anyway!
The HTTP_USER_AGENT value is sent with the request,
as are available cookie values tagged to the server domain.
So you could test for those cookie values, but if absent,
the difference between no cookies available and cookies switched off
cannot be detected without testing for it on the client as shown.
Yes, the powers that defined the cookie mechanism could have defined and
required a cookies-switched-off flag in the page request sent by the
browser, but they did not.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
What annoys me is that first I have to detect if JavaScript is enabled in
order to be able to test whether cookies are enabled.
Agoston
"Patrice" <no****@nowhere.com> wrote in message
news:eX**************@TK2MSFTNGP10.phx.gbl... AFAIK no. You have to test this client side (it could be on the same page depending on what exactly annoys you with client side methods).
Patrice
--
"Agoston Bejo" <gu***@freemail.hu> a écrit dans le message de news:%2****************@TK2MSFTNGP10.phx.gbl... Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe that there's no way to simply test it in a server-side script. Anyone?
Thx, Agoston
You don't need JavaScript. See Evertjan response in this thread...
Patrice
--
"Agoston Bejo" <gu***@freemail.hu> a écrit dans le message de
news:%2***************@TK2MSFTNGP15.phx.gbl... What annoys me is that first I have to detect if JavaScript is enabled in order to be able to test whether cookies are enabled.
Agoston
"Patrice" <no****@nowhere.com> wrote in message news:eX**************@TK2MSFTNGP10.phx.gbl... AFAIK no. You have to test this client side (it could be on the same
page depending on what exactly annoys you with client side methods).
Patrice
--
"Agoston Bejo" <gu***@freemail.hu> a écrit dans le message de news:%2****************@TK2MSFTNGP10.phx.gbl... Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without
moving from one page to another. This should be a very basic functionality, so I am reluctant to
believe that there's no way to simply test it in a server-side script. Anyone?
Thx, Agoston
Evertjan. (before drinking his coffee) wrote:
<snipped> You will have to resort to something like this: 1.asp: <% Response.Cookies("aCookie") = "Hello World" Response.redirect "2.asp" %>
2.asp: <% If Session("aCookie") = "Hello World" Then
^^^^^^^^^^^^^^^^^^
Request.Cookies("aCookie") Response.Write "Cookies Enabled" Else Response.Write "Cookies Disabled" End If %> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sri. |
last post by:
Hi
I am trying to figure out how to test whether my browser cookies are enabled.
I used the code from the following page...
|
by: Sri |
last post by:
Hi
I am trying to figure out how to test whether my browser cookies are enabled.
I used the code from the following page...
|
by: NWx |
last post by:
Hi,
How can I detect is cookies are enabled or not in client browser?
Thanks?
|
by: oreng |
last post by:
Hey all,
I have some problems detecting whether the client's browser javascript
is enabled at the server side.
While Request.Browser.JavaScript only check if the browser enable java
script (and...
|
by: Tee |
last post by:
Hi,
How can we easily detect cookies is enabled?
Thanks
|
by: FishKeeper |
last post by:
I'm trying to write JavaScript code to test whether cookies are enabled
by writing a cookie and then reading its value. My code works fine in
Firefox, but it's not working in Internet Explorer 6. ...
|
by: Victor |
last post by:
I was thinking about an easy to determine if cookies are set or not in ASP. I began
thinking about how the Session ID is dependent upon a cookie - right?
Well, I disabled cookies in Firefox and...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How can I see in javascript if a web browser accepts cookies?...
|
by: stepterr |
last post by:
Hi All,
Does anyone know if it is possible to detect if a user has SSL enabled in their browser? I have a login page that is https but if the user does not have SSL enabled it of course just gives...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
| |