473,721 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session State without HttpSessionStat e

I have the need to keep a substantial amount of session state, but I
do not have the option of using the HttpSessionStat e object. My
current scheme for dealing with this is to convert all the state
values to strings, place them in the query string of the URL passed to
Server.transfer (), and then pull them out again in the next page.
This has a number of problems including the following:

- I have to manually marshall the state to and from a string
representation.
- The query string is limited in length.

The ViewState mechanism almost provides a solution for me. It handles
the marshalling and doesn't have a hard size limit. However, it is
apparent that the designers of the ViewState mechanism did not allow
for the possibility of transfering the contents of view state from one
page to another. I've run into all sorts of problems trying to find
some sort of way to do this. The following things get in the way:

- You can't easily inherit all pages from a common base class.
- View State is unreliable in the Init event.
- The Load event of the Page object fires before the Load event of its
children.

Has anyone found a decent solution to my problem and would they care
to share it?
FYI: HttpSessionStat e is not an option because the application is
distributed across multiple load blanced web servers that are
controled by a beauacracy that decided the environment doesn't need a
state server. Additionally, unless I don't understand something, a
state server seems to put an artificial limit on the redundancy of the
environment, because it represents a single point of failure.
Nov 18 '05 #1
5 3282
You are correct about single pt of failure. However, what about keeping
session info in SQL server? That is easily implemented, and should solve
your problems.

Another option is to generate your own session id, and pass it around via
query string or viewstate, or whatever.

Create your own object with properties for things you need to store for each
session that you created this way. Then place this object into the
Application object, indexing by the sessionid you generated. This works,
you are basically running your own session state here, your only
responsibility is to pass the session id you created around from page to
page.

However, if you have multiple server involved, this means each subsequent
request by the user needs to be to the same machine that initially processed
the request.

"Mike" <gu*********@ho tmail.com> wrote in message
news:23******** *************** ***@posting.goo gle.com...
I have the need to keep a substantial amount of session state, but I
do not have the option of using the HttpSessionStat e object. My
current scheme for dealing with this is to convert all the state
values to strings, place them in the query string of the URL passed to
Server.transfer (), and then pull them out again in the next page.
This has a number of problems including the following:

- I have to manually marshall the state to and from a string
representation.
- The query string is limited in length.

The ViewState mechanism almost provides a solution for me. It handles
the marshalling and doesn't have a hard size limit. However, it is
apparent that the designers of the ViewState mechanism did not allow
for the possibility of transfering the contents of view state from one
page to another. I've run into all sorts of problems trying to find
some sort of way to do this. The following things get in the way:

- You can't easily inherit all pages from a common base class.
- View State is unreliable in the Init event.
- The Load event of the Page object fires before the Load event of its
children.

Has anyone found a decent solution to my problem and would they care
to share it?
FYI: HttpSessionStat e is not an option because the application is
distributed across multiple load blanced web servers that are
controled by a beauacracy that decided the environment doesn't need a
state server. Additionally, unless I don't understand something, a
state server seems to put an artificial limit on the redundancy of the
environment, because it represents a single point of failure.

Nov 18 '05 #2
Are you using SQL Server (or any backend DB) and if so - is keeping
state in the database an option?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 18 Oct 2004 10:47:32 -0700, gu*********@hot mail.com (Mike) wrote:
I have the need to keep a substantial amount of session state, but I
do not have the option of using the HttpSessionStat e object. My
current scheme for dealing with this is to convert all the state
values to strings, place them in the query string of the URL passed to
Server.transfe r(), and then pull them out again in the next page.
This has a number of problems including the following:

- I have to manually marshall the state to and from a string
representation .
- The query string is limited in length.

The ViewState mechanism almost provides a solution for me. It handles
the marshalling and doesn't have a hard size limit. However, it is
apparent that the designers of the ViewState mechanism did not allow
for the possibility of transfering the contents of view state from one
page to another. I've run into all sorts of problems trying to find
some sort of way to do this. The following things get in the way:

- You can't easily inherit all pages from a common base class.
- View State is unreliable in the Init event.
- The Load event of the Page object fires before the Load event of its
children.

Has anyone found a decent solution to my problem and would they care
to share it?
FYI: HttpSessionStat e is not an option because the application is
distributed across multiple load blanced web servers that are
controled by a beauacracy that decided the environment doesn't need a
state server. Additionally, unless I don't understand something, a
state server seems to put an artificial limit on the redundancy of the
environment, because it represents a single point of failure.


Nov 18 '05 #3
"Marina" <so*****@nospam .com> wrote in message news:<OF******* *******@TK2MSFT NGP11.phx.gbl>. ..
You are correct about single pt of failure. However, what about keeping
session info in SQL server? That is easily implemented, and should solve
your problems.
Thank you for your response.

While storing the state in the database will solve the size limitation
option, it still requires me to come up with a marshalling mechanism.
This would involve more complexity than I am willing to accept.
Another option is to generate your own session id, and pass it around via
query string or viewstate, or whatever.


If this was a possibility for me, which it isn't, it would be the ugly
step-child of using the HttpSessionStat e, no?

I'm trying to avoid reinventing the wheel.
Nov 18 '05 #4
I think the SQL Server option that has been discussed is your best bet. But
to address something you said in your post ("you can't easily inherit all
pages from a common base class"); actually, yes you can. Construct your
base class to Inherit from System.Web.UI.P age, and then modify your Page
declaration to read <@ Page Inherits="MyCom monBaseClass" > (with the other
attributes as well, of course). Yes, this will work with Master Pages, too,
but you have to inherit from System.Web.UI.M asterPage, and accessing page
elements is a little trickier.

"Mike" <gu*********@ho tmail.com> wrote in message
news:23******** *************** ***@posting.goo gle.com...
I have the need to keep a substantial amount of session state, but I
do not have the option of using the HttpSessionStat e object. My
current scheme for dealing with this is to convert all the state
values to strings, place them in the query string of the URL passed to
Server.transfer (), and then pull them out again in the next page.
This has a number of problems including the following:

- I have to manually marshall the state to and from a string
representation.
- The query string is limited in length.

The ViewState mechanism almost provides a solution for me. It handles
the marshalling and doesn't have a hard size limit. However, it is
apparent that the designers of the ViewState mechanism did not allow
for the possibility of transfering the contents of view state from one
page to another. I've run into all sorts of problems trying to find
some sort of way to do this. The following things get in the way:

- You can't easily inherit all pages from a common base class.
- View State is unreliable in the Init event.
- The Load event of the Page object fires before the Load event of its
children.

Has anyone found a decent solution to my problem and would they care
to share it?
FYI: HttpSessionStat e is not an option because the application is
distributed across multiple load blanced web servers that are
controled by a beauacracy that decided the environment doesn't need a
state server. Additionally, unless I don't understand something, a
state server seems to put an artificial limit on the redundancy of the
environment, because it represents a single point of failure.

Nov 18 '05 #5
Hi Mike:

The mechanism for marshaling (serialization and rehydration) already
exists with the SerializableAtt ribute. Be more concerned about
performance testing to make sure it is a fit for your application.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 18 Oct 2004 15:09:25 -0700, gu*********@hot mail.com (Mike) wrote:
"Marina" <so*****@nospam .com> wrote in message news:<OF******* *******@TK2MSFT NGP11.phx.gbl>. ..
You are correct about single pt of failure. However, what about keeping
session info in SQL server? That is easily implemented, and should solve
your problems.


Thank you for your response.

While storing the state in the database will solve the size limitation
option, it still requires me to come up with a marshalling mechanism.
This would involve more complexity than I am willing to accept.



Nov 18 '05 #6

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

Similar topics

0
1320
by: Michael O'Brien | last post by:
I'm trying to hook in a specialized state store server into ASP.NET. I understand I can create a HttpModule and hook the events OnAcquireState and OnReleaseState. So far so good. But, it seems that the framework owns the HttpSessionState instance (HttpContext.Session) and so my state store module must use the Add, Remove and Clear methods to interact with the store. ie. on Acquire, I need to call HttpSessionState.Add to add all the...
0
3451
by: matt | last post by:
I've come across a real problem and am totally stuck as to why this is happening, hoping desperately that someone else has experienced the same thing, and knows a solution! Session state should be available from the PrequestHandlerExecute event, and is most of the time for me however sometimes asp.net appears not to load session state at this stage. We have a HttpModule which runs fine 99% of the time however sometimes we have a problem...
5
2446
by: Oleg Ogurok | last post by:
Hi all, Is there a way to read other people's session variables? I understand it makes sense that session state is on per-user basis, but still... Is there a way to get a collection of all current HttpSessionState objects on the server, or at least get a reference to a HttpSessionState objects by session ID ? Thanks.
2
1256
by: aa | last post by:
How to change Session state in the Public class. I was creating the public sub in the public class with byref argument as HTTPSESSIONSTATE and I want to change his value. example: Shared Sub DataDiena(ByVal hplName As HtmlAnchor, ByRef Data As HttpSessionState) end sub How to change the value of "DATA"
3
1088
by: Jim McGivney | last post by:
Session state is a collection. Is it possible to either add or retrieve a value from Session State by specifying an index number in place of a key ? If the Session State is initialized with: Session.add = Value1; Session.add = Value2; Can they be accessed with ? myVar1 = Session;
1
2075
by: ankushmn | last post by:
i am working on web application in Asp.Net, C# in which we are using Outproc session mgt. As we manage session using Outproc there are two ways 1) Sql Server 2) State Server in above we are using State session mgt. In this case i want to know if we use Application variable then where
6
7193
by: tshad | last post by:
Is there a reason to use session.remove over session.contents.remove? Don't they both remove the key and data from the contents collection? I assume that session(x) = nothing does essentially the same thing but is actually deleted later by the GC. Thanks, Tom
11
3654
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
8
996
by: eric | last post by:
I have a 2.0 asp.net project. In a class contained within a seperate project, I am trying to reference HttpContext.Current.Session but Session is always null. I've tried implementing IRequiresSessionState but it does not seem to matter. For a test I created a small solution consisting of a web project and a seperate project to hold a test class. In the test class I reference HttpContext.Current.Session and it works fine with or without...
0
8738
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
9230
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
9148
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
9085
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
8026
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
4499
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...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
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
2146
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.