473,623 Members | 3,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Website is not setting Session cookie for asp.net_session id

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_session id 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
which will
cause this.

This truly drives me crazy right now.

Other notes: I've tried this on 3 different machines and it makes the same
behavior on all of them. (old code fine, new code bad)

But I want to repeat again, I am not doing anything related to actual
session

And a final note: After reviewing alot, I realized that before I use the
session object at least once, application does not set "asp.net_sessio nid"
cookie.
When I set a dummy variable at least once, it works and sets
"asp.net_sessio nid" cookie. However this is still a problem as setting works
after viewing the page for the first time.
As a result cookie is still not availble in the first load but valid
afterwards.

Can someone tell me why my asp.net 2.0 app is not setting this cookie by
default? Am I doing something wrong?

I have the following in my web.config
assemblies:
<add assembly="Micro soft.VisualBasi c, Version=8.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Syste m.DirectoryServ ices, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Syste m.Design, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Syste m.Management, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Micro soft.ReportView er.WebForms, Version=8.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Micro soft.ReportView er.Common, Version=8.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="ADODB , Version=7.0.330 0.0, Culture=neutral ,
PublicKeyToken= B03F5F7F11D50A3 A"/>
<add assembly="Micro soft.ReportView er.ProcessingOb jectModel,
Version=8.0.0.0 , Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A"/>
<add assembly="Syste m.Data.OracleCl ient, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
<add assembly="Syste m.Windows.Forms , Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
<add assembly="Micro soft.Build.Util ities, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A"/>
<add assembly="Micro soft.Build.Fram ework, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A"/>
http handler:
<add path="Reserved. ReportViewerWeb Control.axd" verb="*"
type="Microsoft .Reporting.WebF orms.HttpHandle r,
Microsoft.Repor tViewer.WebForm s, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a" validate="false " />

Aug 12 '07 #1
4 7337
I think this is by design - the Session doesn't "Bake" until a Session item
has actually been set (in ASP.NET 2.0).
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"SevDer" wrote:
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_session id 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
which will
cause this.

This truly drives me crazy right now.

Other notes: I've tried this on 3 different machines and it makes the same
behavior on all of them. (old code fine, new code bad)

But I want to repeat again, I am not doing anything related to actual
session

And a final note: After reviewing alot, I realized that before I use the
session object at least once, application does not set "asp.net_sessio nid"
cookie.
When I set a dummy variable at least once, it works and sets
"asp.net_sessio nid" cookie. However this is still a problem as setting works
after viewing the page for the first time.
As a result cookie is still not availble in the first load but valid
afterwards.

Can someone tell me why my asp.net 2.0 app is not setting this cookie by
default? Am I doing something wrong?

I have the following in my web.config
assemblies:
<add assembly="Micro soft.VisualBasi c, Version=8.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Syste m.DirectoryServ ices, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Syste m.Design, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Syste m.Management, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Micro soft.ReportView er.WebForms, Version=8.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="Micro soft.ReportView er.Common, Version=8.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A" />
<add assembly="ADODB , Version=7.0.330 0.0, Culture=neutral ,
PublicKeyToken= B03F5F7F11D50A3 A"/>
<add assembly="Micro soft.ReportView er.ProcessingOb jectModel,
Version=8.0.0.0 , Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A"/>
<add assembly="Syste m.Data.OracleCl ient, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
<add assembly="Syste m.Windows.Forms , Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B77A5C561934E08 9"/>
<add assembly="Micro soft.Build.Util ities, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A"/>
<add assembly="Micro soft.Build.Fram ework, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= B03F5F7F11D50A3 A"/>
http handler:
<add path="Reserved. ReportViewerWeb Control.axd" verb="*"
type="Microsoft .Reporting.WebF orms.HttpHandle r,
Microsoft.Repor tViewer.WebForm s, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a" validate="false " />

Aug 12 '07 #2
Hi SevDer,

How are you doing? Have you got any progress on this issue?
Please feel free to post here if there is still anything we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 15 '07 #3
Hi Steven,

Just to clarify the issues I'm having.
I've solved the issue by setting a dummy session variable even though I am
not using it.

Now why do I need session when I don't directly use it?
Because I use a syncronized static hashtable where I access the active item
for the session throught the sessionid. My reason for this is because there
are threads working on active object in the hashtable for that session. This
is why I need the session eventhough I don't use it directly.

I hope I made it clear...
SevDer

"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:nS******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi SevDer,

How are you doing? Have you got any progress on this issue?
Please feel free to post here if there is still anything we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 21 '07 #4
Thanks for your followup SevDer,

Now I've got your detailed problem scenario. Yes, I agree that make the
sessionID fixed is quite important in your design.

Thanks again for your posting!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Aug 21 '07 #5

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

Similar topics

9
4703
by: Jimmy Junatas | last post by:
When we open a window (using client-side jscript ie. window.open("/Site/Popup.aspx?...",...)) from Page1.aspx, the called page Popup.aspx does not have access to the Session variables present in Page1.aspx. The IIS Log shows (listed below) shows that the ASP.NET_SessionId cookie is not present in Popup.aspx. The thing is that this mechanism works for 99% of our users. There is this one user that is consistently having this problem. ...
1
9246
by: Daniel Michaeloff | last post by:
Hi all, I have an application that when finished redirects to a non-ASP.NET app which is choking on a huge ASP.NET session cookie. The cookie "ASP.NET_SessionId" gets transmitted by the browser (IE6 in test case) despite trying Microsoft's suggested method of expiring the cookie first. I'd like to be able to kill the cookie and do a Response.Redirect() from within a server-side button handler, but I'm to the point now where I'm...
3
4105
by: Alex Nitulescu | last post by:
Sorry, I'm really confused - I'm only at the middle of my book and already I can count 4 methods to store values. Yes, I know that cookies can not store much, but what is the difference between storing data in the cache object, in a viewstate and in a Session. I can say Cache("MyData")=objDataSet as well as
0
1284
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
13
2816
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i visit again .... null ... again .... it works ..... again ... it works ... again ..... null....... and so on and on .... it does randomly work or not.... what is this effect?
7
7771
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because ASP.NET always sets the Session cookie domain to the full domain (e.g. "www.mydomain.com") instead of the parent domain (e.g. "mydomain.com") The problem with this is when the visitor goes to a different sub-domain (e.g. "search.mydomain.com"),...
0
2505
by: svilst | last post by:
How can I change the path of the cookie 'ASP.NET_SessionId'? The path is "/" and I'd like to set the path to particular virtual directory. The following approach does not work: protected void Session_Start(Object sender, EventArgs e) { HttpCookie cookie = Response.Cookies; if (cookie != null)
2
2043
by: Vikas | last post by:
Hi I am using .Net v1.1 Is there any way to send the session cookie ASP.Net_SessionId Over SSL. Thanks in advance. Vikas
1
5652
by: ALA | last post by:
Hi, does anybody know if it is possible to pass the SessionID with a web request by using a cookie so that the invoked page in the same domain can access the session objects of the current user? HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.CookieContainer = new CookieContainer(); HttpCookie sessionCookie = HttpContext.Current.Request.Cookies;
0
8221
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
8662
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
8463
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
7134
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
5560
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
4154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2593
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
1
1769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1468
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.