.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How can I manage session data outside the ASP.Net session object?

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :ASP.Net

I want to be able to persist data across a session but do this outside of the built-in session state object.  Why is a long story that I will not go into here.  I just need to know where I can put data other than in the session object that will persist across the specific session (in memory - I already have a database solotion).


View Complete Post

More Related Resource Links

send data in class object from one page to another using session


hello everybody

now i hav stored all data like user name, data fatched from database of that user

and i stored that data and user name such as:

string strUserName="user name"

dataset ds =new dataset();// data of that user

now i wan yo send d whole data from my login page to user profile page

can anybody help me for that...................

and plz tell me that how much is this way is benifitial to send data from one page to another page

plz........kindly waiting for positive rply

Using Session to pass data between forms


In my app, I am displaying an Rss Feed, I have a button that takes the user to another form where they can select a them.  Upon selecting the theme, they are taken back to the original form. 

If the user has selected which theme they want to view then they click on the button to change theme, I need to pass the information about what rss feed they were viewing through session so that once they select the theme they want they are redirected back to the main page and the rss feed they were viewing should still be displayed.

Since I've already bound the data to the xmlDataSource and DataList I am trying the following:

Session.Add("CurrentRssFeed", XmlDataSource1.DataFile);

Session.Add("CurrentDataList", DataList1);

I'm not sure I am passing the data over correctly and I'm not sure how to specify it in the page_preinit.

Any ideas???

Changing aspx page causes session data to be lost...


Strange but true. Any ideas what might be causing this?


session object security in asp.net 4

hi,So I'm developing a complicated solution where users need to register, on the web application. I'm not going to use asp.net forms authentication because it would be too complicated to make it work in my app. We do not have SSL, it doesnt need to be super secure but the only thing I am worried about is:When the user logins, he is authenticated, then his username is stored in an asp.net session object. Every protected page then check if there is a username, is there isn't he is redirected. Is this secure?Is there a way an attacker can manipulate a session object to have it store a valid username, which will fool the pages to think that user has logged in. Is there any way to make it slightly more secure without hitting too much on performance?All the options I see are all about forms authentication.Thanks so much

Session Object not set to an instance.....

Hello all, Please tell me if I have made a mistake in the following code. It is part of a class that cycles through various conditions to return a value to aspx page. I get null exception when it hits the session variable. I even declared the session variable in global.asax, and thought that I was checking for null value correctly. Obviously I haven'tImports Microsoft.VisualBasic Imports System.Linq Imports System.Web Imports System.Web.Services Imports System.Web.HttpContext Public Class OrderNumber Public Shared Function GetOrderNumber() As String ' ''//Sets OrderNumber if it exists If Not HttpContext.Current.Request.QueryString("OrderNumber") Is Nothing Then Return CType(HttpContext.Current.Request.QueryString("OrderNumber"), String) ElseIf Not HttpContext.Current.Session("OrderNumber") Is Nothing Then Return CType(HttpContext.Current.Session("OrderNumber"), String) ElseIf Not FindExistingOrder() Is Nothing Then Return FindExistingOrder() Else : Return "" End If End Function   Thanks, I am pretty well stumped. Have a good evening.

WCF using ASP .NET Session and Timer object

I've got a WCF service that handles account management for a Silverlight 4 application. It uses PerSession as the InstanceContextMode and Required as the AspNetCompatibilityRequirementsMode so I can use ASP .NET SessionState (Silverlight only supports BasicHttpBinding, which doesn't support WCF sessions). When the client application calls the Login method, the service sets up a System.Timers.Timer object that fires after five minutes. The client calls a KeepAlive method every thirty seconds to let the service know its still alive, KeepAlive resets the timer. The idea is if the user leaves by closing the browser or leaving the page without properly logging out, after five minutes the timer event fires and it's supposed to set some flags in the application's database. This mostly works. The problem is that HttpContext.Current.Session is always null within the timer event. It works fine within the other methods. Since I can't access session, I can't figure out which user it is to perform cleanup. Can I access the Session object? Is there a better way for me to maintain session state while keeping Silverlight compatibility?

Storing large data in Session State

Hi, We have a scenario where we need to store large tables of data on Session in asp.net page. on a highlevel we have to store following data  1> A table (table 1) with 1000 rows and 8 to 10 columns. 2> A table(table 2) with 500 rows and 8 to 10 columns (actually user can add the data from table 1 to table 2, so as user keeps on adding from table 1 we remove the data and put it in table 2) 3> Another table(table 3) with 1000-1200 rows each having 3 columns. We are having a webfarm, so we need to store it in either SateServer of Oracle DB, please advise which one is better. What would be the performance implications of storing such huge data on the server. One more thing is at any point of time max of 70 -80 people will be accessing our website, so will this cause any performance degradation? Thanks in anticipation Harsha

Retriving data from CheckBoxList and passing it to a Session



I wondering how can I retrive data from a CheckBoxList in c#. and once I get the data I would like to store the data in a session so I can use the data from a session on a another page

Thank you in advance

Data in session



I'm trying to work out what to do with some data I have which is used throughout a users session.

I need to hold up to 200 integers for a customer - not all customers will have 200, some may have none at all.

When I look at what this will consume in session, 1Gb of memory would be enough to support 2m users with full allocation. Even with an extremely busy site, say 1000 simultaneous users, memory would not be stretched.

With this in mind the obvious conclusion is to put the data in session, particularly as the tables data is retrieved from may contain 1m records.

The question I have is - is there anything else i need to consider - any hidden gremlins that I need to watch out for, or is it as simple as that?



Clearing Session Data from Modeless Popup window.


I am using Post method to generate crystal reports. The user requirement is to show the report in a modeless pop up screen. 

The session data needs to be cleared as it may at times contain a very large dataset.  

One implementation I have placed in at present is - placing a button "Close Button". When user clicks close button, I am able to clean up the session content as well as close the window.

The issue I am facing is to get the handle of the modeless window when it is closed using the x button. Also, since the pop up window is modeless, the user might have moved to another screen, henceforth the parent of the popup window is already changed or out of context.

How do we clear the sesssion content when the issue condition arises?

Please provide suggestions.

page inside update panel doesn't refresh the session object after postback of any control



I have many controls like dropdown, radiobuttonlist, etc on my page and I put all these controls inside the update panel so that the page doesn't look to be posting back when something is selected. Now the working on the page is very smooth. But the session object isn't getting refreshed even if I postback to the server and as a result even if the users are working on the page they are being sent to the login screen after 20 mins.

Is there anyway where I could put all the controls in update panel and still refresh the session after any postback(dropdown selection)

Any help is greatly appreciated.

Thanks in advance

Keep updating Session object with a new List c#


I have a Session object

Session["MyListObjects"] = null;

When a user hits a button I want to creat a List<string> object and add to session object.

Let's say if user hits the button 10 times, I would get 10 List<string> objects and
add to Session["MyListObjects"] and

Finally I want to read all the List<string> objects from the session object.

Please let me know how to do that.

How do you manage custom objects and session state



I've created a whole bunch of rather complex classes and now i'm starting to work on the ASP.net user interface.  Basically the user will open 1 page which will be used to load, edit, save an object. The object has many fields and they are often other classes i've created. To create a nice interface i've used popups and used AJAX to reload parts of the page to avoid reloading the whole thing.

My plan was to create the object and save it to the session. Then each time the page is loaded copy the object values to the asp fields and do the reverse when the page has been submitted copying the asp values to the object field then updating the session object.

So the code will go something like:


if session is not null load from session otherwise create new
this.txtID.text = object.id
this.txtName.text = object.name
etc etc

on submit:

object.id = this.txtID.text
object.name = this.txtName.text
etc etc
update session.

Is this what you guys would do? or am i over thinking this, seems like a lot of code to load all the object fields each time the page is opened and submitted etc.

Just looking to bounce ideas of off other developers :D


Retrieve data from SQL server based on login username (session data)



I'm trying to make a dropdown list with data available based on the users login name. Heres what I have as my SQL Query in the SQLDataSource:

SELECT Client_Name, Client_ID FROM Client WHERE (Client_Name LIKE '%@Client_Name%')

So say if the login username is "User1" but the database client name is "User1 Steel" I want the dropdownlist to pull "User1 Steel" as the display and Client_ID as the value from the dropdown list. 

I dont know how to use the session data!

Using session data for SQL query



How would I go about using my session data (ie username) for an SQL query to populate a dropbox? Here is what I have so far:

SELECT Client_Name, Client_ID FROM Client WHERE (Client_Name LIKE '%@Client_Name%')

Am I on the right track?

Storing TcpClient object in session



I am experimenting with an asp.net application wherein I do the following things (simplified for the purpose of this discussion):

1. Take user's gmail username/password (don't fret, I am not doing any nasty stuff Wink).

2. Create TcpClient object and connect it to the Gmail's POP email server using the provided username/password.

3. I am going to use this TcpClient object to download mails for the user.

Following is the problem I face:

1. Say I have presented the user with the subject lines of all his emails.

2. Now he clicks one subject line to download the message. (This will create the post-back to the aspx page)

3. When I receive the post back, will I be able to re-use the same TcpClient object which I connected to the POP server, if I store that object as a Session variable?

I doubt the streams associated with the object will not remain valid.

Is this even the right method to achieve what I am trying to achieve?



Storing session data continuouly




Is it possible to store gridview session data after each postback. I have a gridview and a checkbox within. Each time a user clicks the checkbox, I like to store the gridview ID in a session. After browsing through various pages, I like this session data to continuously store the information up to 20mins?


How can I continously store the session variable. Please can someone provide a sample? Say a text box and if I enter 1 click on a hyperlink (where session variable is stored) return back to the page, enter 2 click hyperlink then I should get in the session 12?

Any one know how to do this? Please provide code in VB.

THanks! Nijojo

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend