473,386 Members | 1,654 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,386 software developers and data experts.

cookie result too long

D.
Hi,

I defined some cookies in order to pass values between pages in my
application.
The problem is that when i request them with:
cookie = Request.Cookies("mycookie")
x = cookie.Value (suppose the value = 'yes')
Response.Write(x)

i get:
'mycookie=yes' instead of just 'yes'.

Any way to avoid the 'mycookie=' or i have to parse the whole string?
Thanks
D
May 12 '06 #1
4 1649
The Value property only contains the value of the cookie, not the name
of the cookie.

How do you create the cookie? Do you use subkeys?

D. wrote:
Hi,

I defined some cookies in order to pass values between pages in my
application.
The problem is that when i request them with:
cookie = Request.Cookies("mycookie")
x = cookie.Value (suppose the value = 'yes')
Response.Write(x)

i get:
'mycookie=yes' instead of just 'yes'.

Any way to avoid the 'mycookie=' or i have to parse the whole string?
Thanks
D

May 12 '06 #2
D.
Thanks for replying.
I created it like this:
<%@ Page Language="VB" %>
<script runat="server">
Sub page_load()
Dim cookie As HttpCookie
Dim lol As String
lol = "yes"

cookie = New HttpCookie("myookie")
cookie.Values.Add("mycookie", lol)
Response.Cookies.Add(cookie)
End Sub
</script>
"Göran Andersson" <gu***@guffa.com> wrote in message
news:OP****************@TK2MSFTNGP02.phx.gbl...
The Value property only contains the value of the cookie, not the name
of the cookie.

How do you create the cookie? Do you use subkeys?

D. wrote:
Hi,

I defined some cookies in order to pass values between pages in my
application.
The problem is that when i request them with:
cookie = Request.Cookies("mycookie")
x = cookie.Value (suppose the value = 'yes')
Response.Write(x)

i get:
'mycookie=yes' instead of just 'yes'.

Any way to avoid the 'mycookie=' or i have to parse the whole string?
Thanks
D

May 12 '06 #3
As I suspected, you are adding a subkey to the cookie.

If you create a cookie like this:

cookie = New HttpCookie("myookie")
cookie.Values.Add("mycookie", lol)

you get the value using:

cookie.Values["mycookie"]
If you create a cookie like this:

cookie = New HttpCookie("myookie")
cookie.Value = lol

you get the value using:

cookie.Value
D. wrote:
Thanks for replying.
I created it like this:
<%@ Page Language="VB" %>
<script runat="server">
Sub page_load()
Dim cookie As HttpCookie
Dim lol As String
lol = "yes"

cookie = New HttpCookie("myookie")
cookie.Values.Add("mycookie", lol)
Response.Cookies.Add(cookie)
End Sub
</script>
"Göran Andersson" <gu***@guffa.com> wrote in message
news:OP****************@TK2MSFTNGP02.phx.gbl...
The Value property only contains the value of the cookie, not the name
of the cookie.

How do you create the cookie? Do you use subkeys?

D. wrote:
Hi,

I defined some cookies in order to pass values between pages in my
application.
The problem is that when i request them with:
cookie = Request.Cookies("mycookie")
x = cookie.Value (suppose the value = 'yes')
Response.Write(x)

i get:
'mycookie=yes' instead of just 'yes'.

Any way to avoid the 'mycookie=' or i have to parse the whole string?
Thanks
D


May 13 '06 #4
D.
Thanks again

"Göran Andersson" <gu***@guffa.com> wrote in message
news:ud**************@TK2MSFTNGP03.phx.gbl...
As I suspected, you are adding a subkey to the cookie.

If you create a cookie like this:

cookie = New HttpCookie("myookie")
cookie.Values.Add("mycookie", lol)

you get the value using:

cookie.Values["mycookie"]
If you create a cookie like this:

cookie = New HttpCookie("myookie")
cookie.Value = lol

you get the value using:

cookie.Value
D. wrote:
Thanks for replying.
I created it like this:
<%@ Page Language="VB" %>
<script runat="server">
Sub page_load()
Dim cookie As HttpCookie
Dim lol As String
lol = "yes"

cookie = New HttpCookie("myookie")
cookie.Values.Add("mycookie", lol)
Response.Cookies.Add(cookie)
End Sub
</script>
"Göran Andersson" <gu***@guffa.com> wrote in message
news:OP****************@TK2MSFTNGP02.phx.gbl...
The Value property only contains the value of the cookie, not the name
of the cookie.

How do you create the cookie? Do you use subkeys?

D. wrote:
Hi,

I defined some cookies in order to pass values between pages in my
application.
The problem is that when i request them with:
cookie = Request.Cookies("mycookie")
x = cookie.Value (suppose the value = 'yes')
Response.Write(x)

i get:
'mycookie=yes' instead of just 'yes'.

Any way to avoid the 'mycookie=' or i have to parse the whole string?
Thanks
D


May 13 '06 #5

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

Similar topics

7
by: N.K | last post by:
Hi , Python's existing cookie module doesnt supports new cookie headers SetCookie2 , How to submit a patch for that ? I tried emailing person who owns that module.But no response. Thanks,...
1
by: Display Name | last post by:
Used one of these canned scripts to set up a JS quiz but not before having used another canned PHP script for "Tell your friend about this Web page!" sort of thing. Now i've gotta integrate them;...
14
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. ...
5
by: Miljana | last post by:
Hi, I have one problem with cookies in ASP.NET application. It seems that I can not retreive cookie from Request.Cookies collection. I put cookie in Response.Cookies collection, and after page...
15
by: Edwin Knoppert | last post by:
I have searched but info is limitted. In my test app i used a non persistant cookie for forms authentication. slidingExpiration is set to true On run and close and rerun the login remains ok....
6
by: jojowebdev | last post by:
Do javascript cookies REALLY have to be this hard? function setCookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getTime() ); if ( expires ) {...
10
by: eyal.herlin | last post by:
hi, i set a cookie to hold a utf-8 string. either by the server or by the client. it doesn't matter. when i try to read this cookie using Request.Cookies("my_utf8_cookie") on iis 5.0 i get...
7
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...
1
by: boss007v | last post by:
Hi, Am adding a cookie and clearing it when logout is clicked,but it persists,the codes are // For Cookie Addtion HttpCookie cookie = new HttpCookie("UserId"); cookie.Value =...
0
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,...
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:
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...

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.