By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,641 Members | 2,101 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,641 IT Pros & Developers. It's quick & easy.

Cookies don't work....HELP!!

P: n/a
I am using C# in ASP (Microsoft Visual Studio.Net) to try and create a cookie. I have cookies enabled on both of my computers, but when I use the following code (I have also tried the commented line as well), no cookies are created. Sometimes the 'index.dat' file gets updated (as far a the last saved date, no reference inside the file), but nothing

NOTE: txt_Reg is a text bo

private void aRegUser(

//Response.Cookies["testRegUser"].Value = this.txt_Reg.Text

HttpCookie RegMyUser = new HttpCookie("testRegUser")
RegMyUser.Value = this.txt_Reg.Text
RegMyUser.Expires = DateTime.Now.AddMonths(1)
Response.Cookies.Add(RegMyUser)
}
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
After this executes, is there a Response.redirect? That can keep cookies
from saving

"Simple Person" <an*******@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
I am using C# in ASP (Microsoft Visual Studio.Net) to try and create a cookie. I have cookies enabled on both of my computers, but when I use the
following code (I have also tried the commented line as well), no cookies
are created. Sometimes the 'index.dat' file gets updated (as far a the last
saved date, no reference inside the file), but nothing.
NOTE: txt_Reg is a text box

private void aRegUser()
{
//Response.Cookies["testRegUser"].Value = this.txt_Reg.Text;

HttpCookie RegMyUser = new HttpCookie("testRegUser");
RegMyUser.Value = this.txt_Reg.Text;
RegMyUser.Expires = DateTime.Now.AddMonths(1);
Response.Cookies.Add(RegMyUser);
}

Nov 18 '05 #2

P: n/a
No. That is basicly all of the code. I call this block from the click event of a button on the page (I am checking to see if anything is entered before I call it). I watch the code and It goes through all of the line in this block of code, just no results. Is there maybe a server setting that needs to be set

----- David Jessee wrote: ----

After this executes, is there a Response.redirect? That can keep cookie
from savin

"Simple Person" <an*******@discussions.microsoft.com> wrote in messag
news:1B**********************************@microsof t.com..
I am using C# in ASP (Microsoft Visual Studio.Net) to try and create

cookie. I have cookies enabled on both of my computers, but when I use th
following code (I have also tried the commented line as well), no cookie
are created. Sometimes the 'index.dat' file gets updated (as far a the las
saved date, no reference inside the file), but nothing
NOTE: txt_Reg is a text bo
private void aRegUser(


//Response.Cookies["testRegUser"].Value = this.txt_Reg.Text
HttpCookie RegMyUser = new HttpCookie("testRegUser")

RegMyUser.Value = this.txt_Reg.Text
RegMyUser.Expires = DateTime.Now.AddMonths(1)
Response.Cookies.Add(RegMyUser)


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.