Hey all,
I'm trying to gain more knowledge about state management and I found an MSDN
Help article about cookies. I posted the short sample below. From what I read
in the article if you do the following
Session("MyObj")=value
cookies have to be enabled on the client browser. Is that true?
If true where can i find that cookie in my pc directories?
About the sample: there's 2 .aspx pages with just 1 label on the first page.
This is a test to see if cookies are enabled on a client browser. But no
matter what setting on the privacy tab i pick, i'm always showing that
cookies are enabled. And each time i delete my cookies after i change the
setting to make sure that there are no existing cookies prior to running the
test.
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
Here's the 2nd page code:
Sub Page_Load()
Dim redirect As String = Request.QueryString("redirect")
Dim acceptsCookies As String
' Was the cookie accepted?
If Request.Cookies("TestCookie") Is Nothing Then
' No cookie, so it must not have been accepted
acceptsCookies = 0
Else
acceptsCookies = 1
' Delete test cookie
Response.Cookies("TestCookie").Expires = _
DateTime.Now.AddDays(-1)
End If
Response.Redirect(redirect & "?AcceptsCookies=" & acceptsCookies, _
True)
End Sub
any ideas?
thanks,
rodchar 3 1207 cookies have to be enabled on the client browser. Is that true?
Yes, to store a cookie, the browser has to enable this.
If true where can i find that cookie in my pc directories?
Documents And Settings\UserName\Cookies About the sample: there's 2 .aspx pages with just 1 label on the first page. This is a test to see if cookies are enabled on a client browser. But no matter what setting on the privacy tab i pick, i'm always showing that cookies are enabled. And each time i delete my cookies after i change the setting to make sure that there are no existing cookies prior to running the test.
You may want to close the browser sessions ( all of them ) down after
changing this setting
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
Here's the 2nd page code:
Sub Page_Load() Dim redirect As String = Request.QueryString("redirect") Dim acceptsCookies As String ' Was the cookie accepted? If Request.Cookies("TestCookie") Is Nothing Then ' No cookie, so it must not have been accepted acceptsCookies = 0 Else acceptsCookies = 1 ' Delete test cookie Response.Cookies("TestCookie").Expires = _ DateTime.Now.AddDays(-1) End If Response.Redirect(redirect & "?AcceptsCookies=" & acceptsCookies, _ True) End Sub
any ideas? thanks, rodchar
how do i turn off cookies on my browser. it looked as though i could goto
internet options and on the privacy tab set it to block all cookies but even
when i do that the sample program below still says AcceptCookies=1 instead of
0.
"One Handed Man ( OHM - Terry Burns )" wrote: cookies have to be enabled on the client browser. Is that true? Yes, to store a cookie, the browser has to enable this.
If true where can i find that cookie in my pc directories? Documents And Settings\UserName\Cookies
About the sample: there's 2 .aspx pages with just 1 label on the first page. This is a test to see if cookies are enabled on a client browser. But no matter what setting on the privacy tab i pick, i'm always showing that cookies are enabled. And each time i delete my cookies after i change the setting to make sure that there are no existing cookies prior to running the test.
You may want to close the browser sessions ( all of them ) down after changing this setting
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
Here's the 2nd page code:
Sub Page_Load() Dim redirect As String = Request.QueryString("redirect") Dim acceptsCookies As String ' Was the cookie accepted? If Request.Cookies("TestCookie") Is Nothing Then ' No cookie, so it must not have been accepted acceptsCookies = 0 Else acceptsCookies = 1 ' Delete test cookie Response.Cookies("TestCookie").Expires = _ DateTime.Now.AddDays(-1) End If Response.Redirect(redirect & "?AcceptsCookies=" & acceptsCookies, _ True) End Sub
any ideas? thanks, rodchar
Rodchar,
It is completly depending the browser you are using, when you real want to
know than in your situation I would go to a more browser newsgroup. That
because I think that most of us here are like me not anymore looking too it.
By instance with IE it seems for me that it changes with every security
update from Microsoft.
Just my thought,
Cor
"rodchar" <ro*****@discussions.microsoft.com> how do i turn off cookies on my browser. it looked as though i could goto internet options and on the privacy tab set it to block all cookies but even when i do that the sample program below still says AcceptCookies=1 instead of 0.
"One Handed Man ( OHM - Terry Burns )" wrote:
> cookies have to be enabled on the client browser. Is that true? Yes, to store a cookie, the browser has to enable this.
> If true where can i find that cookie in my pc directories? Documents And Settings\UserName\Cookies
> > About the sample: there's 2 .aspx pages with just 1 label on the first > page. > This is a test to see if cookies are enabled on a client browser. But > no > matter what setting on the privacy tab i pick, i'm always showing that > cookies are enabled. And each time i delete my cookies after i change > the > setting to make sure that there are no existing cookies prior to > running > the > test. You may want to close the browser sessions ( all of them ) down after changing this setting
> > > > 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 > > > Here's the 2nd page code: > > Sub Page_Load() > Dim redirect As String = Request.QueryString("redirect") > Dim acceptsCookies As String > ' Was the cookie accepted? > If Request.Cookies("TestCookie") Is Nothing Then > ' No cookie, so it must not have been accepted > acceptsCookies = 0 > Else > acceptsCookies = 1 > ' Delete test cookie > Response.Cookies("TestCookie").Expires = _ > DateTime.Now.AddDays(-1) > End If > Response.Redirect(redirect & "?AcceptsCookies=" & acceptsCookies, _ > True) > End Sub > > any ideas? > thanks, > rodchar
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |
last post by:
I''m having a problem with cookies that is driving me insane :).
- If a user comes to http://domain.com and a cookie is set for them, then the user for whatever reason jumps to http://www.domain.com...
|
by: chrism |
last post by:
Hello,
I have a pop-up window that I would like to appear in front of the
browser home page when a user opens IE. Problem is, I'd like it to
never appear again if the user navigates back to the...
|
by: M Wells |
last post by:
Hi All,
Just wondering how you go about changing the value of a session cookie
via javascript?
I have a PHP page that sets a session cookie when it first loads. I'd
like to be able to change...
|
by: Mike |
last post by:
Hello,
I can't find any javascript that reads and writes cookies with keys,
so that it is compatible with ASP (I want to read and write cookies
from both javascript and ASP)
for example in...
|
by: Alec S. |
last post by:
Hi,
I'm using JavaScript and Cookies for some customization in a web page.
There may be several values in the cookie with names that are not known at
runtime. I need a way of deleting them.
...
| |
by: Ben Amada |
last post by:
Every time a user visits a particular page, I'm using the code below to add
a cookie that expires in 1 day.
My question is, a user may visit this page a few times within one day.
Before adding...
|
by: hecsan07 |
last post by:
I am trying to perform site login using values from a cookie, but for some
weird reason the cookie is being destroyed after the browser window is
closed. I checked the browser settings for the...
|
by: CR1 |
last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
|
by: monomaniac21 |
last post by:
hi
i have a php site which allows users to save a cookie on their
computer which stores their user id details and allows them to auto-
login.
i'm wondering whether this is safe, is it...
|
by: kelly.pearson |
last post by:
Is this a bug? I am trying to write a cookie that can be accessed by
various .Net applications on our domain. However, whenever I add the
domain property to the cookie, no errors get thrown but...
|
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,...
| |
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...
|
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,...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |