473,765 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cookie s["Signature"].Value = Signature.Text;
Response.Cookie s["Signature"].Expires = DateTime.Now.Ad dMonths(6);

and the cookie appears to be written with no errors. But I cannot locate
the cookie file under "Documents and Settings\Userna me\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="fal se", if that matters.

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

Your Signature.Text assignment. Is that protected by a if (
!Page.IsPostBac k ). 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******** ******@TK2MSFTN GP10.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.Cookie s["Signature"].Value = Signature.Text;
Response.Cookie s["Signature"].Expires = DateTime.Now.Ad dMonths(6);

and the cookie appears to be written with no errors. But I cannot locate
the cookie file under "Documents and Settings\Userna me\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="fal se", if that matters.

-Johnnie

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

Your Signature.Text assignment. Is that protected by a if (
!Page.IsPostBac k ). 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","MyUserLo gin","MyCompute rID".
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
3554
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
1064
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 (which i think is where .NET cookies go?). Then I want to read from that cookie, in a .NET app, later on. My thinking today was to try a js cookie, since .NET cookies are too difficult to write (need Interop etc). Unfort, when I write a js...
4
1667
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 getting the one cookie? Thanks, - Stew
6
8754
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 other link using "GET" method, i found that the cookies data has not included in the request. Here is the sample: ' sURL is the URL of server page ' pCookies is a varible contain the cookies data
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.