Session variables vs. Session States
What is the difference and in what situations are they used.
A session state (the state of your session) holds your session variables. If your session state expires (due to inactivity) then you lose your session variables...and any other info stored for that session.
If you need to store USER specific information within a web app, then session variables are one(of several) ways to do it.
Is there any code that you could show that would give an example?
example of what? reading and writing session variables?
...Opinions on Viewstate vs. Session variable for state management on dataset
I came across many sample codes that using ViewState(myDataSet) and Session("myDataSet"). Which is a better way to use to keep the session around. What are the pros and cons? Anybody can share with your experience or thoughts?
Take a loot at this article:
State Management in Web Forms
http://www.c-sharpcorner.com/Code/2004/Feb/StateManagementInWebForms.aspDarrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!...Passing variables vs session variable
what is the advantage of passing the variable in the url vs storing the variable in a session variable and retrieving it in the second webpage you are accessing?
The variable that you will pass using the QueryString will be visible to the user hence not secured. The value that you put in the Session is not available to the user as it is on the server side and hence more secured. HighOnCodingWanna get high!
performance wise does it matter?
Just my 2 cents...
I remember in college the professors would always harp upon using the Session responsibly. Most of the professors were old...Cache Variable vs. Session Variable
I'm anxious to get some feedback with regard to using a cache variable in lieu of a session variable.
My research tells me that caching is the way to go for maintaining state on datasets. However, I've only seen the cache variable discussed as an alternative to an application variable (as opposed to the session variable). I'm actually exploring the idea using of using a cache variable as an alternative to a session variable for maintaining state on a dataset specific to each user (Each user is able to select the fields they wish to view; the user will then be able to page and sort on th...global variable vs local variable
i have a scenario like function is called more than 1000 times.in that function i declared a varible and assigning a value .i felt like declare a global varible use it in that function and assign value.which is best.please tell me in performance point of view.
thanks in advance
Hai Good Morning you have call the function more than 1000 times Better use Global variables, so you can call the function, anywhere.. it has good performance.suppose it you want assign different values to the variables , whenever the function has been called for that use local ...global variable/object without session or application variable
I have 1 or more dynamically assigned user controls. Now i need to pass a user control's value to another user controls during page load. We can do using session variable, but the problem over here is it would slow down my application. So i would like to attain this without using the session or application variable.
Please let me know if you have any questions.
thiyaThank you in advance. I am pleased to return the favor.
Read this post.Jared LivingstonMrLivingston.com - Livingston Family WebsiteTest/Demo site - moonmark.com
Reviewed the posted reply. That one...Session Variables lost after Response.Redirect()
I encouter lost session variables trouble when Response.Redirect() to another aspx page. I set 19 Session variables before redirecting. However, the redirected page's session contains only One variable.
The very weir sympton is: If I restart IIS, only for the first IE encounter, the redirected page DOES show all 19 session variables.Once I close IE, any further IE or IE from any other machine's only shows ONE session variable.
I can also reproduce such symptons in VS2005 development environment.
Can someone tell me what I have missed? Thanks!
Here is ...variable variables?
How to make a variable receive an increment in the name?
I want to do it for example:
Label1->Caption = "1";
Label2->Caption = "2";
Label3->Caption = "3";
Label4->Caption = "4";
And I want to do something like that:
for (i=1; i<5; i++)
Label+i->Caption = i;
Any idea? Can I do something like that?
Thanks and regards
Create a vector of pointers to the various objects.
In your case below, construct a vector (called Labels) of pointers to TLable
long enough to hold pointers to...Losing session variables after response.redirect
I'm using StateServer to manage my sessions.
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:1702" />
I then set the session values as follows on one page:
Session("UserID") = dbReader("UserID")Session("FirstName") = dbReader("FirstName")Response.Redirect("~/member/Default.aspx")
When it redirects to the next page, the session values are blank (null). I'm not sure at all what's happening. The IIS settings are fine as well.
XP Pro, ASP.NET 2.0, IIS 5.
There are too many protential reasons for session loss, and here is a newly post article on this, whi...Variable Variables
Maybe the solution is very simple, but how do I create variable variables in vb.net? I want to use the value of a variable as a part of the name of another variable. A very simple example below:
Dim a As String
a = "1"
Label a.Text = "hi"
<asp:Label id="Label1" runat="server">Label</asp:Label>
In need this to change a range of values by using just one loop. I can´t do that without creating a variable variable name.
check out this little demo application I created for you:
...Session State variable missing after Redirect
When an error occurs, I set a session variable so that after redirecting to an error page, a detailed explanation can appear. The variable (a string) is gone by the time I reach Page_Load in the target page.
I've checked and it is the same session ID. Any ideas?
Are Sessions enabled?
Are you forwarding to a page outside of you application?View My Blog Download My URL Rewriter and Reverse ProxyOnly $9.95/month, ASP.NET, 2GB & SQL 2005...variable not a variable
Error:Must declare the variable '@cartDateTime'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@cartDateTime'.
Dim connStr As SqlConnection Dim cmdInsert As SqlCommand Dim strInsert As String &n...variable of variables
Say I have 2 scenarios and I want to use a different
variable depending on which scenario applies without coding
So I could have a database table t_variables which has:
In my Powerbuilder code I'd have values in v_name &
What I'd like to be able to do is to select which variable
to use from the table and assign that to something, e.g.
where scenario = 1
so at this point v_variable would be 'v_name'...Global Variables vs. instance variables declared at application object level
There is only one application object instance during the application runtime
that is instantiated at the start along with the global variables, so I am
looking for what are the major differences, advantages , and disadvantages
between Global Variables and instance variables declared for the application
I've wondered also about the application instance variables.
I think the difference with global vars is very subtle. Maybe too subtle to
be of any use.
Anyway, you shouldn't be using either one of them :-)
Geert 'Darling' Van Damme
Moh...Public Shared variable vs. application state variable -- exactly identical??
I've done several searches on this topic in the forums here, but I'm still not 100% sure I know the answer to this question: is declaring a public shared variable in global.asax the same thing as using Application("xxx")? If so, is there any reason to use Application state variables at all when you can get all the benefits (eg. code completion) of using the public shared variable?
I just found this blurb in a Ask Dr. Gui.NET article on MSDN and now I'm more confused than before:
An important note: while it's just fine to use static/Shared methods in ASP.NE...