<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Getting Started</title><link>http://forums.asp.net/15.aspx</link><description>The perfect forum for ASP.NET novices. No question too simple! &lt;A href="http://aspadvice.com/SignUp/list.aspx?l=21&amp;amp;c=17" target=_blank&gt;Email List&lt;/A&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Cookie Help</title><link>http://forums.asp.net/thread/2565876.aspx</link><pubDate>Tue, 19 Aug 2008 07:28:23 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2565876</guid><dc:creator>Zong-Qing Li - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2565876.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2565876</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Based on my understandings, you create the cookies in the first page, and then transfer to another page named second page. In the second page you get the cookie&amp;#39;s value. But if the second page redirect to the third page, you can&amp;#39;t get the cookie&amp;#39;s value in the third page. If I understood the issue, I suggest to run the following code which run well under my environment.&lt;/p&gt;
&lt;p&gt;First.aspx.cs&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Page.Response.Cookies.Add(New System.Web.HttpCookie(&amp;quot;employeeid&amp;quot;, &amp;quot;My Value&amp;quot;))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(&amp;quot;Second.aspx&amp;quot;)&lt;/p&gt;
&lt;p&gt;Second.aspx.cs&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myVariable As String = Page.Request.Cookies(&amp;quot;employeeid&amp;quot;).Value&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(myVariable)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(&amp;quot;Third.aspx?id=&amp;quot; &amp;amp; Request.Cookies(&amp;quot;employeeid&amp;quot;).Value)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;Third.aspx.cs&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim readFcookie As String = Page.Request.Cookies(&amp;quot;employeeid&amp;quot;).Value &amp;#39;read from cookie&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(&amp;quot;read from cookie &amp;quot; &amp;amp; readFcookie)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(&amp;quot;&amp;lt;br/&amp;gt;&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim readFget As String = Request.QueryString(&amp;quot;id&amp;quot;).ToString() &amp;#39;read from cookie&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(&amp;quot;read from get &amp;quot; &amp;amp; readFget)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/p&gt;
&lt;p&gt;If it still not work, please post some relative code for here. I understand that this may be a lot of information to ask for at one time. However, by collecting this information now, it will help us move more quickly toward a solution.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If I misunderstood the issue, please inform of me.&lt;/p&gt;</description></item><item><title>Re: Cookie Help</title><link>http://forums.asp.net/thread/2561112.aspx</link><pubDate>Fri, 15 Aug 2008 19:21:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2561112</guid><dc:creator>chekmate</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2561112.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2561112</wfw:commentRss><description>&lt;p&gt;Now I am able to see the cookie on the page I am writing it, but as soon as I redirect to the next page the cookie seems to disappear. &lt;/p&gt;For example, &lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;Response.Redirect(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/Admin/Default.aspx?id=&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Request.Cookies(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;employeeid&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).Value)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;takes me to the page with the id set to a number, but once on that page I cannot read the value from the cookie itself&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Cookie Help</title><link>http://forums.asp.net/thread/2560013.aspx</link><pubDate>Fri, 15 Aug 2008 08:36:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2560013</guid><dc:creator>O11Y</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2560013.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2560013</wfw:commentRss><description>&lt;p&gt;I can&amp;#39;t see anything immediatly wrong with what you&amp;#39;re doing. I personally use the Cookies.Add method to register new cookies so you could try it instead:&lt;/p&gt;
&lt;p&gt;(Writing)&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;Page.Response.Cookies.Add(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; System.Web.&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;HttpCookie&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;My Cookie&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;,&lt;font color="#a31515"&gt;&amp;quot;My Value&amp;quot;&lt;/font&gt;));&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;(Reading)&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;if&lt;/font&gt;&lt;font size="2"&gt; (Page.Request.Cookies[&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;My Cookie&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;] != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;myVariable = &lt;/font&gt;&lt;font size="2"&gt;Page.Request.Cookies[&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;My Cookie&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;].Value; // myVariable = &amp;quot;My Value&amp;quot;&amp;nbsp;&lt;/font&gt;&lt;font size="2"&gt;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Cookie Help</title><link>http://forums.asp.net/thread/2559812.aspx</link><pubDate>Fri, 15 Aug 2008 05:48:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2559812</guid><dc:creator>chekmate</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2559812.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=15&amp;PostID=2559812</wfw:commentRss><description>&lt;p&gt;My site was working a week ago, and now suddenly it isn&amp;#39;t. &lt;/p&gt;
&lt;p&gt;I can&amp;#39;t get it to read the cookies I am saving. Maybe you can help. &lt;/p&gt;
&lt;p&gt;This is how I am writing the cookie:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; cookie &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; HttpCookie = Request.Cookies(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;EmployeeID&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;font size="2"&gt; Request.Cookies(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;EmployeeID&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Is&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Nothing&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;Response.Cookies(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;EmployeeID&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).Value = Request.QueryString(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;employeeid&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;Response.Cookies(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;EmployeeID&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).Expires = DateTime.Now.AddDays(7)&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;And now I can&amp;#39;t get the site to read the cookie for use in datagrids etc.&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>