473,326 Members | 2,655 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,326 software developers and data experts.

Cookies Not Written When Debugging?

I am trying to debug a C# ASP.NET application in VS.NET. I have added a
text box to my form for storing a user signature which I am trying to
persist using cookies.

In my Page_Load() I have added the following:
try
{
Signature.Text = Request.Cookies["Signature"].Value;
}
catch
{
Signature.Text = "";
}

It seems that this cookie is always null, even though I trace through my
code as follows that is executed on a button press:
Response.Cookies["Signature"].Value = Signature.Text;
Response.Cookies["Signature"].Expires = DateTime.Now.AddMonths(6);

and the cookie appears to be written with no errors. But I cannot locate
the cookie file under "Documents and Settings\Username\Cookies".
Is there a cookie writing restriction when debugging in the VS.NET IDE?
Thanks for any help. My code seems simple enough, but please let me know if
something is wrong there.

My Web.config has cookieless="false", if that matters.

-Johnnie
Nov 18 '05 #1
2 1617
Without seeing all your code, let me say this.

Your Signature.Text assignment. Is that protected by a if (
!Page.IsPostBack ). If it is not then you are setting the .Text property of
that control to String.Empty on postback, so when the button click executes
it will be placing in a String.Empty.

just a thought.

If you want post some more code, but no, cookies have nothing to do with
being in the IDE debugger.

Now what is really strange is there should always be a cookie with the
session id. Are you sure you are looking for the correct cookie name?

HTH,

bill

"Johnnie Norsworthy" <jl****@verizon.net> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
I am trying to debug a C# ASP.NET application in VS.NET. I have added a
text box to my form for storing a user signature which I am trying to
persist using cookies.

In my Page_Load() I have added the following:
try
{
Signature.Text = Request.Cookies["Signature"].Value;
}
catch
{
Signature.Text = "";
}

It seems that this cookie is always null, even though I trace through my
code as follows that is executed on a button press:
Response.Cookies["Signature"].Value = Signature.Text;
Response.Cookies["Signature"].Expires = DateTime.Now.AddMonths(6);

and the cookie appears to be written with no errors. But I cannot locate
the cookie file under "Documents and Settings\Username\Cookies".
Is there a cookie writing restriction when debugging in the VS.NET IDE?
Thanks for any help. My code seems simple enough, but please let me know if something is wrong there.

My Web.config has cookieless="false", if that matters.

-Johnnie

Nov 18 '05 #2
"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:uo**************@TK2MSFTNGP09.phx.gbl...
Without seeing all your code, let me say this.

Your Signature.Text assignment. Is that protected by a if (
!Page.IsPostBack ). If it is not then you are setting the .Text property of that control to String.Empty on postback, so when the button click executes it will be placing in a String.Empty.

just a thought.
Yes, right before the assignment in my Page_Load code I have:
if (IsPostBack) return;
This prevents all of initialization code, including the Signature.Text
assignment from running again. Tracing the code proves this is the case.
Now what is really strange is there should always be a cookie with the
session id. Are you sure you are looking for the correct cookie name?


I looked under every Documents & Settings user listed and no new cookies
ever appear. That is under, "Default User","MyUserLogin","MyComputerID".
What should it be named? I sorted all of the cookies by date to see the
newest and nothing new appears. I noticed under D&S/MyUserLogin/Cookies/
that the Index.dat file is touched (date changed) when I run my app. But I
never see any new cookies there.
Where should it be located?

It *could* be an issue with Norton Internet Security, but other cookies have
been saved fine this week, just not from my application. I disabled NIS,
and that did not help.

I'm sure there is a simple answer to this, but I am a newbie and the books I
have make it look so simplistic I can't see the problem.

Thanks,
Johnnie
Nov 18 '05 #3

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

Similar topics

20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
0
by: Jason Shohet | last post by:
I need a simple cookie to be written from dos commands (a batch file), and go into the cookies folder, to be a textfile that is easily readable -- not an encrypted thing in the index.dat file...
4
by: Gridlock | last post by:
I'm trying to read the cookies using HttpContext.Current.Request.Cookies, but the only cookie that I get is the ASP.NET SessionId cookie. There are many cookies on the machine, why am I only...
6
by: James MA | last post by:
I'm now writing a small program to communicate a web server to simulate a web client. I use te httpwebrequest to talk with the server, and it works find for "POST" method, however, when i test...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.