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

Unable to read cookie value

Hi,

I am unable to read a cookie value from the cookies. i have set cookie value from javascript in scripting side and try to read cookie value from coding part ie. default.aspx.vb. i have shown my javascript page below:
Expand|Select|Wrap|Line Numbers
  1. <pre lang="cs">function setcookie()
  2.    {
  3.    var today=new Date();
  4.    var expire=new Date();
  5.    var ndays;
  6.    if(ndays==null || ndays==0)ndays=1;
  7.    expire.setTime(today.getTime() + 3600000*24*nDays);
  8. document.cookie = "hostname"+"="+VIH_HostName+ ";expires=&"+expire.toGMTString();
  9. alert(VIH_HostName)
  10. }</pre>
this function called from onload in body tag.

here is my vb code to read cookie value
Expand|Select|Wrap|Line Numbers
  1. <pre lang="vb">If Not Request.Cookies("hostname") Is Nothing Then
  2.                            count = Request.Cookies("hostname").Value
  3.                            Response.Write("cookie: " & count)
  4.                      End If</pre>

If I read the cookie I get only null string.. anyone help me to resolve this problem..

regards
Sasikumar
Nov 11 '10 #1
2 2499
Frinavale
9,735 Expert Mod 8TB
I don't see any JavaScript code posted.
I see something that looks like JavaScript but... it isn't valid and it isn't within <script type="javascript"> tags.

Are you seeing JavaScript errors in your browser?
Nov 12 '10 #2
No i am not see the javascript errors but i need the to pass value from javascript which is placed in asp source code side to coding part ie default.aspx.vb..
Nov 13 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
How does one read and write the cookie expiration date. At the moment my code is returning a value BUT a garbled value: '//Write cookie... Response.Cookies("Propsect").Expires = Date() + 1 ...
2
by: terry | last post by:
Hi, When I store cookie value "12:05:33" and read it again, I find the value become "12%3A05%3A33", how to read or convert it correctly? Thanks!
0
by: Kevin | last post by:
Hello, all experts: May I ask you some questions? First, i'm programming a software of auto-authentication by using VB.NET tool. This software's functions is similar to do the account login...
0
by: anibakore | last post by:
Hi All, I am using product.xml for vs2005 pre-requisites. I am using <RegistryCheckinside <InstallCheck>. I am trying to read one registry value of installed software. I can see it through...
3
by: korque | last post by:
Hi I'm gathering information from web page, first I get headers and store recieved cookies then I get source with file()-function. Is there easy way to send cookie value back to host on each...
1
by: ricknew | last post by:
Hi Folks, We are setting cookies on our site so anonymous visitors can save items for a quote: The cookies are set as follows: GUID = System.Guid.NewGuid().ToString();...
1
by: rajunarender01 | last post by:
hi i am working with the usercontrol and want to update the cookie value in the user control how to do it
0
by: javaBookWorm | last post by:
203.114.10.66 - - "GET...
3
by: webster5u | last post by:
Miss/Mr. Programmer, I have a idea to remove the cookie value from a website after all browser closed. It is like session kept in server and eliminate after all browser closed. My purpose is...
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
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...
1
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...
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
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...
0
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,...

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.