473,653 Members | 3,000 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Won't save session object

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 nothing
when they should contain data. Is there something that needs to be done in
the application or on the server that can fix this? How can I get the
session objects to hold the data when the application goes live?

Scott
Nov 18 '05 #1
14 3375
Are cookies enabled on the machines that don't work properly? Session
cookies must be allowed for session state to work.

"Schoo" <sc***********@ nospam.ma-hc.com> wrote in message
news:OL******** ******@TK2MSFTN GP09.phx.gbl...
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 nothing when they should contain data. Is there something that needs to be done in the application or on the server that can fix this? How can I get the
session objects to hold the data when the application goes live?

Scott

Nov 18 '05 #2

Or you can change the web.config file and alter the 'sessionState' section to enable 'cookieless' session handling. This mangles the URL of each request to include the unique session id, which is ugly... but it works.
----- Marina wrote: -----

Are cookies enabled on the machines that don't work properly? Session
cookies must be allowed for session state to work.

"Schoo" <sc***********@ nospam.ma-hc.com> wrote in message
news:OL******** ******@TK2MSFTN GP09.phx.gbl...
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 nothing when they should contain data. Is there something that needs to be done in the application or on the server that can fix this? How can I get the
session objects to hold the data when the application goes live?
Scott

Nov 18 '05 #3
Hi Scott,
Thanks for posting in the community!
From your description, you found your web application's sessionstate not
work when it is visited by some certain workstation client side on your
side,yes?
If there is anything I misunderstood, please feel free to let me know.

As for the problem you mentioned, I think Marina's suggesion is quite
informative, as he mentioned that this problem is likely due to those
client machine's cookie setting.

In fact, the ASP.NET's session is by default associated with all the client
machine via cookie variable named "ASP.NET_Sessio nId" which identitfy the
unique session id of the certain user. If the client machien has disabled
the cookie in its browser, that'll cause the client unable to associate its
sessionstate on the serverside, then we'll found the session not work. So
would you please try checking the client's browser to see whether the
cookie has been disabled?
You can check in the Browser's setting. In IE, you can find the setting in
the tools-->interntet options-->privacy setting panel and see whether
you've block the certain site's cookie

Also, another means to detect the cookie is to write some code in a certain
ASP.NET page to write a certain cookie variable and then retrieve back it ,
for example:
if(!IsPostBack)
{
Response.Cookie s.Add(new HttpCookie(...) );
}
else
{
//get the certain cookie via Request.Cookies[...].Value;
}

If unable to retrieve the cookie from clientside again, there must be
something incorrect with the client's cookie setting.

In addtion, here are some tech artielcs on ASP.NET session and cookie
implementation:

#Underpinnings of the Session State Implementation in ASP.NET
http://msdn.microsoft.com/library/en...ionstate.asp?f
rame=true

#basics of cookies in asp.net
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vbtchaspnetcook ies101.asp

#Enabling Cookieless Session State in ASP.NET
http://msdn.microsoft.com/msdntv/epi...20030318ASPNET
RH/manifest.xml

http://www.eggheadcafe.com/PrintSear...asp?LINKID=401

Hope they're helpful.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #4
I am going to read the links you provided on session state and cookies and
develop a test application which may take me a few days to finish (I have
other projects pending), but I wanted to add these comments and get the
group's input:

Marina and Cheng both commented that the workstations need to have cookies
enabled. The symptoms of the issue don't support that as a problem and here
is why: When I am sitting at the test server and run the program with the
URL: http://localhost/program.aspx it runs the session objects fine, but if
I use http://<testservername >/program.aspx it will not store state. Also, I
can run the program on the development workstation in debug mode, but I
can't run it on the same server accross the network from the test server.

I will do the research which will take me some time, but I don't see why
this is such a big problem. In classic ASP I used to just create my session
objects and go. Did Microsoft really complicate this so much that I will
need to take hours to learn the new architecture? Isn't there just
something in web.config or IIS that I can change to make these work right?
Here is the session state object in my web.config file:

<sessionState
mode="InProc"
stateConnection STring="tcpip=1 27.0.0.1:42424"
sqlConnectionST ring="data source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="fal se"
timeout="20"
/>

I just want to pass a variable through a session state. My question is:
what is the simplest way to get that done so I can let my beta-group test
this?

Scott
"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:GH******** *****@cpmsftngx a07.phx.gbl...
Hi Scott,
Thanks for posting in the community!
From your description, you found your web application's sessionstate not
work when it is visited by some certain workstation client side on your
side,yes?
If there is anything I misunderstood, please feel free to let me know.

As for the problem you mentioned, I think Marina's suggesion is quite
informative, as he mentioned that this problem is likely due to those
client machine's cookie setting.

In fact, the ASP.NET's session is by default associated with all the client machine via cookie variable named "ASP.NET_Sessio nId" which identitfy the
unique session id of the certain user. If the client machien has disabled
the cookie in its browser, that'll cause the client unable to associate its sessionstate on the serverside, then we'll found the session not work. So
would you please try checking the client's browser to see whether the
cookie has been disabled?
You can check in the Browser's setting. In IE, you can find the setting in
the tools-->interntet options-->privacy setting panel and see whether
you've block the certain site's cookie

Also, another means to detect the cookie is to write some code in a certain ASP.NET page to write a certain cookie variable and then retrieve back it , for example:
if(!IsPostBack)
{
Response.Cookie s.Add(new HttpCookie(...) );
}
else
{
//get the certain cookie via Request.Cookies[...].Value;
}

If unable to retrieve the cookie from clientside again, there must be
something incorrect with the client's cookie setting.

In addtion, here are some tech artielcs on ASP.NET session and cookie
implementation:

#Underpinnings of the Session State Implementation in ASP.NET
http://msdn.microsoft.com/library/en...ionstate.asp?f rame=true

#basics of cookies in asp.net
http://msdn.microsoft.com/library/de...us/dv_vstechar t/html/vbtchaspnetcook ies101.asp

#Enabling Cookieless Session State in ASP.NET
http://msdn.microsoft.com/msdntv/epi...20030318ASPNET RH/manifest.xml

http://www.eggheadcafe.com/PrintSear...asp?LINKID=401

Hope they're helpful.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #5
Hi Scott,
Thanks for your response. I also don't think this is a big problem. Do you
think it convenitent that you just make a very simple web application, just
one asp.net web page and test the session state when using the
"http://<testservername >/..." sytle url ? Also, you can turn on the page's
or application's Trace mode, set Trace = true in the page , that'll be
helpful for you to troubleshoot the problem. Additionally, I also doubt
that whether it is due to the server's configuration, would you try test
the web app on some other servers and apply the same test on it to see
whether the problem remains? Anyway, if you have got any progress or new
findings, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #6
I developed a test app. It has the same effect. Very simple. Here is the
code:

WEBFORM1.ASPX
<page contains a text box and a button>
Private Sub Button1_Click(B yVal sender....)
Session("text") = TextBox1.Text
Response.Redire ct("WebForm2.as px")
End Sub

WEBFORM2.ASPX
<page contains a text box>
Private Sub Page_Load(....)
TextBox1.text = Session("text")
End Sub

NOTE: I let VS create a new ASP.NET Web Application, added the 2nd webform
and only added the code shown above. I set up a virtual directory through
IIS on the test server called "cookietest ".
RESULT WHILE SITTING AT SERVER (IE5.0): Works fine with URL:
//<testservername >/cookietest
RESULT FROM WINXP WORKSTATION ON LAN (IE6): Session object value is not
shown in box on Webform2.aspx
RESULT FROM WIN98 WORKSTATION ON LAN (IE5.5): Session object value is not
shown in box on Webform2.aspx

The server is running .NET Framework 1.1. There has to be a setting here or
something, I can't be the only one that has ever had this happen. Is there
another method I need to use to invisibly hold variables for the session? I
hate to go to SQL Server to do this (especially for a test). What am I
missing here?

Scott
"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:Ha******** ******@cpmsftng xa07.phx.gbl...
Hi Scott,
Thanks for your response. I also don't think this is a big problem. Do you
think it convenitent that you just make a very simple web application, just one asp.net web page and test the session state when using the
"http://<testservername >/..." sytle url ? Also, you can turn on the page's or application's Trace mode, set Trace = true in the page , that'll be
helpful for you to troubleshoot the problem. Additionally, I also doubt
that whether it is due to the server's configuration, would you try test
the web app on some other servers and apply the same test on it to see
whether the problem remains? Anyway, if you have got any progress or new
findings, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


Nov 18 '05 #7
Hi Scott,
Have you tried the cookie? Using the below code:
Response.Cookie s.Add(new HttpCookie("tes tcookie","testv alue"));
to set a cookie and get it via
HttpCookie tc = Request.Cookies .Get("testcooki e");

Becaues by default the session on the server is associated with clientside
with a certain cookie variable named
"ASPNET_Session Id" , so if the cookie doesn't work correctly, of course the
Session won't be able to work correctdly.
And you can use the ASP.NET page's Trace to simply check the cookie or
session collection, just trun on the page's trace in the @page directive as
below:
<%@ Page language="c#" ... Trace="true" .... %>

Please try it out and let me know the result so as for us to do some
further research on this. Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #8
I am still having problems:

I went to
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vbtchaspnetcook ies101.asp and used it to create the following
example:

WEBFORM1.ASPX
<page contains a text box and a button>
Private Sub Button1_Click(B yVal sender....)
Response.Cookie s("username").V alue = Tetbox1.Text
Response.Cookie s("username").E xpires = Now.AddDays(1)
Response.Redire ct("WebForm2.as px")
End Sub

WEBFORM2.ASPX
<page contains a text box>
Private Sub Page_Load(....)
If Not Request.Cookies ("username") Is Nothing Then
TextBox1.text = Server.HtmlEnco de(Request.Cook ies("username") .Value)
End If
End Sub

RESULT: Exact same results as before from all 3 machines. Here are the
results again:
RESULT IN DEBUG MODE ON DEVELOPMENT MACHINE: Successful! (also confirmed
that a cookie file was created on the workstation)
RESULT WHILE SITTING AT SERVER (IE6): Works fine with URL:
//localhost/cookietest (also confirmed that a cookie file was created on the
workstation), does not work with URL: //<testservername >/cookietest
RESULT FROM WINXP WORKSTATION ON LAN (IE6): Cookie value is not
shown in box on Webform2.aspx and no cookie file created.
RESULT FROM WIN98 WORKSTATION ON LAN (IE5.5): Cookie value is not
shown in box on Webform2.aspx and no cookie file created.

The fact that this works in debug mode on the development machine and when
selecting "localhost" on the server itself, ought to be a major clue here
don't you think? Most interesting is that it will run on the server using
"localhost" but won't run on the server using the server name. Also
consider that we get the same outcome whether we do this with a session
object or with a cookie. What do you think the problem is that would cause
that to happen?

Scott
"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:9$******** ******@cpmsftng xa07.phx.gbl...
Hi Scott,
Have you tried the cookie? Using the below code:
Response.Cookie s.Add(new HttpCookie("tes tcookie","testv alue"));
to set a cookie and get it via
HttpCookie tc = Request.Cookies .Get("testcooki e");

Becaues by default the session on the server is associated with clientside
with a certain cookie variable named
"ASPNET_Session Id" , so if the cookie doesn't work correctly, of course the Session won't be able to work correctdly.
And you can use the ASP.NET page's Trace to simply check the cookie or
session collection, just trun on the page's trace in the @page directive as below:
<%@ Page language="c#" ... Trace="true" .... %>

Please try it out and let me know the result so as for us to do some
further research on this. Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #9
Hi Scott,

Thanks for your response and the further test result infos. Now we've got
that the problem is caused by the cookie unable to store at client side.
I'm not sure whether it is caused by some security issue, the certain site
name(via the //machine name/..) has been blocked at the client at default
privacy level. Would you please try out the following steps:
At the client machine which the session not work, open the IE's
tools-->internet options.. menu and choose the "Privacy" panel and then you
can see the cookie privacy level slide bar, by default the value is
"Medium" , please check it. If so, try turn it down to "low" or "accept all
cookies" and then close and restart IE and visist the site to see whether
the problem remains. If the cookie or session works, I think maybe there is
something incorrect with the privacy setting on the serverside. I'll
continue to troubleshoot on the server machine's cookie privacy setting.
Please try out the suggestions and let me know if you got any progress.
Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #10

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

Similar topics

1
2100
by: Philip Chan | last post by:
I am using ASP3.0 and IIS5 I want to have OOP so I have define a class call Employee with property 'fullName' and methods like getFullName(). To save a group of employee in session, I use a dictionary. ----------------- dim employees set employees = CreateObject("Scripting.Dictionary")
4
3709
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml file via some editable controls such as text boxes , option boxes etc. how can i implment this , should i use another xslt file with <INPUT> controls . if so how can i save the result back using the asp.net
1
2918
by: Bob | last post by:
I'm wondering how much more memory an XmlDocument object takes than the corresponding Xml string? I have some user data to store in ASP.NET session and everytime it's used, an XmlDocument object is needed. If there's not too much difference in the memory consumption, then saving the object would make more sense than just saving the string. On a side note, is there a way to find out the memory usage of a variable at runtime? Does...
3
3301
by: mo | last post by:
I have an application that uses Reporting Services. When the user chooses to print a report, they are taken to a window that allows them to fill in parameters for the report. They then click a button to either export to PDF or to EXCEL. Once the report is generated, the byte array containing the data is put into session and an aspx page is loaded into a hidded iframe that "prints" the report (using the byte array from session) causing...
6
2079
by: AAOMTim | last post by:
I have a large ViewState and I've heard I can save the ViewState in a sesison object. What are the advantages of doing so and how do I do it? I've been told that I am gettign DNS timeouts because of the ViewState being too large. I'm trying to avoid writing manual paging routines for now. -- Tim
4
1651
by: jamesb457 | last post by:
I'm getting this error a lot, it was working reasonably well, but then for no apparant reason, it stopped. I have a class, basically: public class ShoppingBasket { int count; String Items; public AddItem()
6
4136
by: Josetta | last post by:
Access 2003 I've been experiencing some problems with my "monster" database the last couple of days. I imported all objects into a new database yesterday, which pretty much stopped the crashing problems, but here's something weird: Whenever I copy an object (reports so far), I am able to open it and make changes, but when I try to save it (without closing), it appears to save (message box goes off), but it doesn't. Then, if I try to...
0
1723
by: TaraPriest | last post by:
Hi all, I've got a vb.net web application that is using a web service to stream documents from a repository. Once the service feeds me the document I'l downloading it using the browser response functions. If I choose to Save it works every time. If I choose to open the file I get an error saying the file cannot be found, create a new file? The save does occassionally work, every other attempt at best. Any ideas would be appreciated!
3
2804
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I need to control the visibility of a textbox based on a dropdown selection in the datalist's edititem template. To do this, I registered a client script block function and attached a client side handler for the dropdownlist's onchange event in the...
0
8283
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
8704
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...
0
8590
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...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5620
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
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
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
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
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.