473,609 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing data in ASP.NET

Jax
Say for example a user of my website makes a selection on the site and I want to store that value for use on a later page what is the best way to do that?
My only method at the moment that I know would be to create a static class and static variables inside of that. But if more then one person was using the page would they be using the same variables? Or do they get a version of the static class each?
I dont know, which is why I ask.

jax
Nov 15 '05 #1
2 1735
Jax,

You are right, if the class was static, then the whole application would
have access to those variables. The best way to store data is to use the
HttpSessionStat e type, which is exposed through the Page class through the
Session property. Also, it is exposed through the HttpContext class,
through the Session property on that class. The type has an indexer which
is a hashtable. You can place whatever keys/values you wish in there
(depending on how you are storing the values, if they are persisted to an
ASP session server, SQL server, or in memory).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jax" <an*******@disc ussions.microso ft.com> wrote in message
news:81******** *************** ***********@mic rosoft.com...
Say for example a user of my website makes a selection on the site and I want to store that value for use on a later page what is the best way to do
that? My only method at the moment that I know would be to create a static class and static variables inside of that. But if more then one person was using
the page would they be using the same variables? Or do they get a version of
the static class each? I dont know, which is why I ask.

jax

Nov 15 '05 #2
Jax
Nicholas,

Thanks once more for the help, I think i'll use the Session.Keys collection to store the data. Sounds good.

Jax
Nov 15 '05 #3

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

Similar topics

2
1763
by: Francisco | last post by:
I have this problem: I have a database with information about games, and users are able to vote for them. Everytime a user votes for a game I store the unique game name into a session variable (an array). So if they are in a page were they already voted, they won't have the option to do so. The idea is that the session cookie lasts "forever", I don't want them voting for the same game everytime they get to the site. This isn't soo strict,...
1
2132
by: Kay | last post by:
A linked list is storing several names. I want to make a queue if I input a name that is same as the linked list. How to make each node of a linked list storing a queue that are different with each other node, do I need to add one more item in the ListNode OR I only call the queue insert function to do it ?
7
3634
by: Dave | last post by:
I have a system that basically stores a database within a database (I'm sure lots have you have done this before in some form or another). At the end of the day, I'm storing the actual data generically in a column of type nvarchar(4000), but I want to add support for unlimited text. I want to do this in a smart fashion. Right now I am leaning towards putting 2 nullable Value fields: ValueLong ntext nullable ValueShort nvarchar(4000)...
6
3039
by: bissatch | last post by:
Hi, I am currently writing a news admin system. I would like to add the ability to add images to each article. What I have always done in the past is uploaded (using a form) the image to a folder on the server and then in the database table that I INSERT the news article, I'll store the path of the uploaded image. To me this seems a bad idea as if the image paths were changed on the
1
11213
by: VMI | last post by:
Is it possible to store the data in a datatable in the hard disk instead of the memory? By default, when a datatable's being filled, the table (and data) will remain in memory. Would it be possible to save this data in another medium besides the memory? Everything would stay the same but instead of filling up the datatable by storing it in the memory, i'd be storing it somewhere in the hard drive. Thanks.
6
3167
by: Kyle Teague | last post by:
What would give better performance, serializing a multidimensional array and storing it in a single entry in a table or storing each element of the array in a separate table and associating the entries with the entry in the other table? Having a separate table would result in two queries instead of one, but you wouldn't have to deal with the overhead of serializing and unserializing data. -- Kyle
6
3188
by: (PeteCresswell) | last post by:
User wants to go this route instead of storing pointers in the DB and the documents outside. Only time I tried it was with only MS Word docs - and that was a loooong time ago - and it seemed to me like there were performance issues at the time. How about the different types? The MS docs I would expect Access to differentiate and handle appropriately (i.e. .DOC and .XLS).. but how about ..PDF? and can I stash a .TXT document in the...
20
4624
by: Martin Jørgensen | last post by:
Hi, I'm reading a number of double values from a file. It's a 2D-array: 1 2 3 4 5 6 7 ------------- 1 3.2 2 0 2.1 3 9.3 4
7
1876
by: Mike | last post by:
I have developed an application, for psyc patients.... they type in very personal information in a web form to help them work through problems in their lives. Once they enter the info, I encrypt the data and store it in a MySQL database. Users can then print, edit, delete or share the information they entered with their therapist. I'm not happy storing this in the database for two reasons: (1) my host places restrictions on my database...
4
2060
by: Falcolas | last post by:
I personally feel that it's a bad idea. I've got to convince managerial types of this. Would some of you mind posting comments for and against the concept of storing data in XML attributes? If you've got nothing good to say for it, I'm OK with that too. Thanks ahead of time for your input. ~G
1
8188
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
8374
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
6969
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
5502
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
4002
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
4059
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2502
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
1630
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1366
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.