Session Variables Vs Session Class

Hi All,

I am rewriting a classic ASP application in .NET using ASP.net and C#.

We used Session Variables to handle storing the current user information throughout the original application.  I was wondering what the benefits would be of using a Session Class over Session Variables, and also how I could implement this?

Many thanks in advance for any information you can give me.

Regards,

Aj

0
azza85
2/23/2009 9:16:13 AM
asp.net.state-management 8807 articles. 0 followers. Follow

2 Replies
1191 Views

Similar Articles

[PageSpeed] 19

Check this out.

I think Session class always beneficial since you have more control over accessing and setting your session variables and exception handling. Check the link for its sample implementation.

http://www.ironspeed.com/articles/Manage%20Session%20Variables/Article.aspx

 


Thanks,
santosh_maharaja

Please mark as answer if you got expected solution.
0
santosh_maharaja
2/23/2009 11:53:31 AM

 In Asp.Net the session is more configurable through the web.config. You can save the session in process or out of the process in a state server or SqlServer if you are planning on using web farms.

using  session["val"]= "hello" ; would work perfect in asp.net too

check this out

http://msdn.microsoft.com/en-us/library/ms178581.aspx


Mark as an answer if it helps.
0
almargob
2/23/2009 7:40:32 PM
Reply:

Similar Artilces:

Session variables vs. Session States
What is the difference and in what situations are they used. Thanks, Mattypee 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. MajorCatsMajorCats Is there any code that you could show that would give an example? Thanks, Mattypee example of what? reading and writing session variables? ...

Loosing session state when I call a session variable from a derivated class
Hi folks I'm having an annoying problem. I have a web application which is used to edit some database data. The databases content may be in various languages, having one database for each language. I load a database calling it by the database name and the language suffix (for example: database_eng, when 'eng' is the laguage variable). So, I need to set a session variable 'Language', which is used in any webpage that calls information from a database. The problem I have is in some classes, which stores some methods to obtain information from databases. These clas...

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? Thanks, teresa 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!...

session vs caching vs control state vs view state
difference between session and cache and view state and control state which is used at what time and for what purpose exactly Hi,this article explains it the best: ASP.NET: Nine Options for Managing Persistent User State in Your ASP.NET Application.Grz, Kris.  Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Variables VS Session + Multiple Session Timeouts
I've read that "http is stateless" which is one reason people use Session variables instead of code behind variables. I'm having problems with session variables vanishing after about 10mins. I've checked "App Options" under "Application Configuration" under the properties of the Virtual Directory (IIS 5 on Win2000).  It sais "Session Timeout = 59mins"  web.config <authentication mode="Forms"> <forms timeout="60" /> </authentication>  <sessionState timeout="58" />   Im using master pages, and have declared public variable and session variab...

Session State Variables across multi sessions
I am having an issue where I save my DataTable into a Session Variable:   Session["dtDMFile"] = dtDMFile; Different users can use the web form that I created. Once the data is loaded,I send the DataTable to the session variable. My problem is that when I go to reload the data in the table, it is taking the data from the last user who stored the DataTable instead of from the particular user on their browser. For instance, User 1 (machine 1) loads data with field contents of: field1  field2  field3 User 2 (machine 2), then loads data with field contents of: f...

Managing Session variables in a class
First, I am a newbee, very new and think i have gotten in trouble with this one. I want to create a class (i thought I did until i tried a second page) that can help me manage my session variables like session("userguid") through out the session for an individual. the thought was that there is a lot of information that continues to change and using a class if i set a value, it can automatically run code to do processing. So, for example, I have the following as my class: (short view of class) The name of this file is UserSession.vb Imports System.Data.SqlClient Public ...

The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increas
Hi.. I am making a mobile application using .net framework 2.0. My Application has  web farm scenario so for state management  I am using Sateserver in my application. My application runs fine if I dont use web farm scenario But in case of web farm scenario it is giving me error "The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit."   &...

"The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increa
Hi.. I am making a mobile application using .net framework 2.0. My Application has web farm scenario so for state management I am using Sateserver in my application. My application runs fine if I dont use web farm scenario But in case of web farm scenario it is giving me error "The page requires session state that is no longer available. Either the session has expired, the client did not send a valid session cookie, or the session state history size is too small. Try increasing the history size or session expiry limit." I am not getting why this error is coming ..Though I already h...

When does Session.Abandon remove session variables (.NET 1.1)?
I have a logout function which includes session.abandon. This also (correctly) removes any session variables I've created if I look at them on the next page load. However, if I examine these variables immediately after the session.abandon call, they still exist with their current values. Where in the page life cycle does session.abandon actually remove these variables? Thanks in advance.  -- ZLA  After you have called Abandon() method, current session becomes invalid, but new session will be created on the next request. If you need to remove all values from session coll...

Session-to-session
I must be missing something. I can not get the tabs to come back as they were when a session is ended. On the Main tab, I have "Show my windows and tabs from last time" On the Privacy tab, I have "Always clear my private data" with ONLY Download History, Cache, and Authenticated Sessions selected. When I close a session and then restart Firefox, I only get a single blank tab. -- The Frosted Flake +------------------------ SPAM is for eating ------------------------+ Frosted_Flake wrote: > I must be missing something. I can not get the tabs to come...

Session vs Cookie State management
 I have always been confused by this, even when I use PHP. Session & Cookies are two most common State management techniques.Sessions last until browser is closed, and Cookies persist beyond that. All that's fine.But I have also heard of permanent vs temporary cookies. And I have also read that a browser not set to accept cookies at all, cannot be tracked using sessions. All this has led me to conclude that temporary cookies are managed in memory & are the way sessions are managed. When the browser is closed, in memory-cookies are lost, and thus the sessions is over.And cook...

Session state variable in class library
Hi guys,  How can I get hold of a session state variable in a class library (middle-tier), that is referenced by my web app? ThanksThe best glimpse of heaven is on the way into hell ;)yousef.omar@gmail.comhttp://nonstopbiztalk.blogspot.com You can get the current context to use it into the library HttpApplication.Context.Current.SessionCheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question! First you will need to add a reference to the System.Web assembly. Once you've done that, you can access Session using: System.Web.HttpCon...

State management upon session variable changes
I noticed that whenever a session variable is changed...the application knows about it and suddenly restarts session. My question is does restart "ALL" sessions or only the active sessions for which the variables changed? Imagine a "multi-user" application all with different states and an administration panel that lets you change session variables.  In this case, my question has to do with the question that if Company X changes his session variables, will only Company X's sessions be reset or will all "sessions" be reset?  Hope that makes sense. ...

Web resources about - Session Variables Vs Session Class - asp.net.state-management

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

YouTube v10.32 Tweaks Some Interface Elements And Includes Hints About Virtual Reality Content And Variable ...
Forget Update Wednesday! Monday is the new big day. Not only were we treated to the latest M preview release and the official Marshmallow name, ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Expert Reveals the Latest Variable Capacity Technology
Learn about gForce Ultra CRAC equipment, the latest variable capacity technology to lower energy usage and increase reliability.

AD/CVD ruling and overseas capacity expansions are variables to the current PV boom, says EnergyTrend ...
China's National Reform and Development Commission has announced that there will be no significant reduction in feed-in tariff (FiT) rates for ...

Resources last updated: 12/17/2015 10:00:54 PM