473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Session Variable Length

Does anybody no the max length of data a session variable can contain ?
Nov 18 '05 #1
5 7132
I don't believe there are any size of length restrictions. Of course, if you
have lot's of users, and you are storing large objects in session, you need
to consider how much memory you have at your disposal.

"BobTheHacker" <an*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
Does anybody no the max length of data a session variable can contain ?

Nov 18 '05 #2
FWIW - I've been storing about 2000 chars in one of mine on a certain page
and no problems so far.


"BobTheHacker" <an*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
Does anybody no the max length of data a session variable can contain ?

Nov 18 '05 #3
length restrictions do not apply to the ASP.NET intrinsic objects like
session because they holds references. The limitation, as Marina pointed
out, is available memory on the machine.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"D. Shane Fowlkes" <sh**********@h-o-t-m-a-i-l.com> wrote in message
news:OX**************@tk2msftngp13.phx.gbl...
FWIW - I've been storing about 2000 chars in one of mine on a certain page
and no problems so far.


"BobTheHacker" <an*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
Does anybody no the max length of data a session variable can contain ?


Nov 18 '05 #4
We blew one the other day that was over 4,000 charcters. I thought I read somewhere that they were limited to 4kb. But I would like to confirm that.
Nov 18 '05 #5
Nope. Here's the proof of concept.

namespace WebApplication2
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
System.Text.StringBuilder str = new System.Text.StringBuilder();
for (int i = 1; i < 2000000; i++)
str.Append(i.ToString()).Append(",");

Session["Test"] = str.ToString();
TextBox1.Text = Session["Test"].ToString();
}
}

The size of the cache is only capped by memory. I have cached datasets as
large as 167 megs.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"BobTheHacker" <an*******@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
We blew one the other day that was over 4,000 charcters. I thought I read
somewhere that they were limited to 4kb. But I would like to confirm
that.

Nov 18 '05 #6

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

Similar topics

1
by: Ryan Hubbard | last post by:
I've have been trying to serialize an array of objects. I can serialize and set a session variable and retrieve it successfully for a serialize string of any length within the contents of a single...
1
by: Jawahar Rajan | last post by:
All, I know that using Session.Contents is frowned upon by some. But I feel I am in situation where I cannot avoid it. I think it is better than using a QueryString. Is there a length on the...
1
by: Scott Wickham | last post by:
I'm having a problem saving session information on one form and retrieving it on a subsequent form...for only one out of a number of users. Actually, I'm not absolutely certain it's a session...
3
by: Enoch Chan | last post by:
I would like to set a Session variable to a value. In Vbscript it should be Session("ZoomValue")=500 How can I set this session variable by using Javascript? Thanks
14
by: dale zhang | last post by:
Hi groups, Can anyone give me the equivalent C# sharp code for this VB.ET code, :: VB.NET :: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
4
by: rgparkins | last post by:
Hello I am running out of time with a problem I have running PHP 5.04 and Apache 2.0 and really need help :(. I have a page that stores a variable in session but each time I reload that page the...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
3
by: sjsean | last post by:
All thanks in advance for reading my post. I am new to using js and more accustomed to vbscript. I had written code which created a shopping cart into an array using vbscript and then...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.