473,763 Members | 5,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session cleared after setting cookie?

I'm having a problem with the session being reset after setting a
cookie. This is not supposed to happen. If I comment out the Add
line below the site works normally, the session persists. Help.

vs2003/.net 1.1

HttpCookie httpCookie = new HttpCookie("myC ookieName");
httpCookie.Valu e = (string)Session["myString"];

// BUG: adding the cookie kills the session.
base.Response.C ookies.Add(http Cookie);

May 4 '06 #1
3 2254
running your test code does not kill the session on my end.

How are you testing if the session is killed or not.
do you have full code that we can test?

SA
"Paul" <---@---.---> wrote in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
I'm having a problem with the session being reset after setting a cookie.
This is not supposed to happen. If I comment out the Add
line below the site works normally, the session persists. Help.

vs2003/.net 1.1

HttpCookie httpCookie = new HttpCookie("myC ookieName");
httpCookie.Valu e = (string)Session["myString"];

// BUG: adding the cookie kills the session.
base.Response.C ookies.Add(http Cookie);

May 4 '06 #2
I don't have complete sample code at this time.

I am checking SessionID as well as session variables.

Immediatley after the Add the sesssion is still ok. But then I redirect
to another page and in this new page I see the SessionID is changed and
my variables cleared.
MSDN wrote:
running your test code does not kill the session on my end.

How are you testing if the session is killed or not.
do you have full code that we can test?

SA
"Paul" <---@---.---> wrote in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
I'm having a problem with the session being reset after setting a cookie.
This is not supposed to happen. If I comment out the Add
line below the site works normally, the session persists. Help.

vs2003/.net 1.1

HttpCookie httpCookie = new HttpCookie("myC ookieName");
httpCookie.Va lue = (string)Session["myString"];

// BUG: adding the cookie kills the session.
base.Response .Cookies.Add(ht tpCookie);


May 4 '06 #3
Q: Why does the SessionID changes in every request?
A: This may happen if your application has never stored anything in the
session state. In this case, a new session state (with a new ID) is created
in every request, but is never saved because it contains nothing.

Check out http://www.eggheadcafe.com/articles/20021016.asp

SA

"Paul" <---@---.---> wrote in message
news:OP******** ******@TK2MSFTN GP04.phx.gbl...
I don't have complete sample code at this time.

I am checking SessionID as well as session variables.

Immediatley after the Add the sesssion is still ok. But then I redirect to
another page and in this new page I see the SessionID is changed and my
variables cleared.
MSDN wrote:
running your test code does not kill the session on my end.

How are you testing if the session is killed or not.
do you have full code that we can test?

SA
"Paul" <---@---.---> wrote in message
news:ef******** ******@TK2MSFTN GP03.phx.gbl...
I'm having a problem with the session being reset after setting a cookie.
This is not supposed to happen. If I comment out the Add
line below the site works normally, the session persists. Help.

vs2003/.net 1.1

HttpCookie httpCookie = new HttpCookie("myC ookieName");
httpCookie.V alue = (string)Session["myString"];

// BUG: adding the cookie kills the session.
base.Respons e.Cookies.Add(h ttpCookie);



May 5 '06 #4

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

Similar topics

1
7787
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
14
3384
by: Schoo | last post by:
I have an asp.net app that uses session objects (ag. session("UserID")). The app works fine in development/debug mode. I released it to the test server (Windows 2000 server with other .NET applications running on it) and when I am sitting at that server running the application, it also runs fine. But, if I sit at any workstation on the LAN it does not work. I narrowed the problem down to the fact that all of the session objects contain...
1
737
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can find one? Thanks Werner P.S. Somehow I did not manage to do a followup in Googles newsgroups.
0
1293
by: briand | last post by:
I have the following code in my base page to redirect to a session timeout page. override protected void OnInit(EventArgs e) { base.OnInit(e); //It appears from testing that the Request and Response both share the
8
1745
by: ari | last post by:
hey all, i'm trying to make my app as stateless as possible. is it ok to create a dataset and store in viewstate and whenever the user decides to select a from that dataset, to move from viewstate, to session, and on the details page back to viewstate. Or does that sound like too much work? thanks, ari
11
3658
by: Glenn | last post by:
Hi I've been experimenting with managing state using the Session object. I've created a simple WS with a couple of methods, one which sets a string value, another that retrieves it. Each method has the WebMethodAttribute.EnableSession set to true. When I run the test page the session is maintained. However, using a console application, in between setting the string value and attempting to
4
7359
by: SevDer | last post by:
Hi, I've done some coding in my web application however right now for an unknown reason my asp.net 2.0 site is not setting asp.net_sessionid cookie and as a result, I am losing the session data in each page refresh or redirect. I really do not have any coding against how the session works. And I have not changed any setting in IIS. I even compared the 2 code(old and new) bases and didn't see anything funny
4
6125
by: Yonih | last post by:
Hey Yall, I am trying to incorporate a Once Per session Cookie that will expire once the browser is closed so some one who comes to my website will see my popup the first time her visits the website but it wont keep showing as one navigates throughout the site however if he closes the browser and reopens out site it will show again. Here is the script that I was using that started out to work once per session but after publishing the...
16
1845
by: Jonathan Wood | last post by:
Greetings, I was wondering if anyone here has a good understaning of the Session object. I know there are options like the Session.Abandon method and the regenerateExpiredSessionId setting, although I do not understand what they do. Can anyone tell me if it's possible for a recycled session to still contain the old data? I had a couple of reports that where users said they logged on and saw another user's data. On this site, there...
0
9564
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
10148
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...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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
9823
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
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
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.