473,326 Members | 2,148 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,326 software developers and data experts.

'Per user' variables

H
In creating an ASP.NET page in C#, I notice that it seems very efficient with regards to things like what I would call 'pooling', for instance: I have a string variable that the Page_Load procedure checks and if it is null/empty, it loads the value from the registry. Now I notice the sub-procedure to actually get the value out of the registry only seems to get called the first time the page is viewed since the last rebuild, even if you close the browser and open the page up again on another client, the variables don't seem to get cleared. Another thing I notice that I have a datagrid control that dynamically gets data from a database using an SqlConnection connected to SQL Server in the Page_load event, but when I navigate to the page for the second time since rebuild (even on a different terminal) the display of the data is instant, like it's cached the page - but even if the data has changed. I presume this must be because it's maintained the connection and that it is the actual making of the connection rather than the running of the SQL query that takes the time, since it is a stored procedure that is very light on resources

But, this brings me to ask

What if I *want* some variables to be cleared - i.e. I'm not really sure about where I should be drawing the line as to what defines a 'session', but supposing I want a variable that is 'per session', i.e. that resets itself when the user logs off from the site/navigates to a different site/closes the browser?
Nov 18 '05 #1
1 1427
Session variables could be your answer(e.g. myStr = Session(strName)). At logoff, you could set each one to nothing

Please note, though, Session variables should be used sparingly. They are saved on the server, not the client, and if there is 'heavy' traffic, many Session variables used by many users can harm performance
Nov 18 '05 #2

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

Similar topics

0
by: peter_bradley | last post by:
Hi all, Not sure if this is possible, but can I change the controls of a command button on a per record bases in a subform. In my case, I would like to make a command button visible only if...
0
by: Eidolon | last post by:
I remember reading about how you can change the allowed users or not for any given resource in a web app using a LOCATION key in the web.config. I was wondering, is there any way to also have...
1
by: Bonj | last post by:
H In creating an ASP.NET page in C#, I notice that it seems very efficient with regards to things like what I would call 'pooling', for instance: I have a string variable that the Page_Load...
4
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session -...
3
by: nzanella | last post by:
Hello, I just ran into the restriction of ASP.NET allowing no more than one <form> tag with the runat="server" attribute per page. This seems like a big restriction to me. I ran across the...
2
by: anassar | last post by:
I have an ASP.Net Web Application where I depended on Sessions to share information across the code. One of the buttons the user clicked, take a long time to process. So, I started...
8
by: KMZ_state | last post by:
We have a question here where a developer says that if the same user starts 2 instances of the application on his machine, the session variables may get mixed up b/c the session is PER IP ADDRESS. ...
32
by: Matias Jansson | last post by:
I come from a background of Java and C# where it is common practise to have one class per file in the file/project structure. As I have understood it, it is more common practice to have many...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.