Store Session In A Collection (key, Value) During One Page?
Jan 19, 2010How can I store session in a collection (key, value) during one page. I must be able to add and remove items.
Is there an existing control?
How can I store session in a collection (key, value) during one page. I must be able to add and remove items.
Is there an existing control?
Its related to datatable in gridview store in session and then session retrive and store to database. basically i am using gridview here creating new row for button click and these row adding untill user's last entry then submit all these entry to database. so i want to use session variable to store this data temporarily and after final entry user click on submit button and all data shold be save in db.
View 9 RepliesI am working on a web application that is consuming a Dataset returned by a web service. As the application is running I store that Dataset as a session variable to be used over and over again as the user navigates to the different pages that will edit the tables within the dataset. The idea was the user will only have to wait for the data once when the application loads then the application would use the session variable until the user saves the changes they made, when that happens it would pass the edited tables to the service to update the database. Is there problems with this design and the storage of the Dataset and Datatables as a session variable?
View 4 RepliesWhich is best option to store confidential information in a page?Control,Session,QueryString etc ... ?And also the performance also should be good ... ?
View 11 RepliesI have a class called EditMapUtilities. Here are some class properties that I want to persist:
public class EditMapUtlities
{
public static Boolean isInitialEditMapPageLoad
{
get { return SessionHandler.isInitialEditMapPageLoad; }
set { SessionHandler.isInitialEditMapPageLoad = value; }
}
// REST OF CLASS NOT GERMAIN TO DISCUSSION AND OMITTED
}
Here is my SessionHandler Class following the pattern from this post Static Session Class and Multiple Users:
using System.Web.SessionState;
public static class SessionHandler
{
private static HttpSessionState currentSession
{
get
{
if (HttpContext.Current.Session == null)
throw new Exception("Session is not available in the current context.");
else
return HttpContext.Current.Session;
}
}
//A boolean type session variable
private static string _isInitialEditMapPageLoad = "EditMapInitialPageLoad";
public static bool isInitialEditMapPageLoad
{
get
{
if (currentSession[_isInitialEditMapPageLoad] == null)
return true;
else
return (Boolean)currentSession[_isInitialEditMapPageLoad];
}
set
{
currentSession[_isInitialEditMapPageLoad] = value;
}
}
}
I am still learning OOAD. I want to keep relevant properties with relevant classes. I also want to keep all Session stored variables in one place for ease of maintenance and to encapsulate the session keys and calls. I feel like my design is too coupled though. How can I make it more loosely coupled? Is my editMapUtilities class too tightly coupled to the SessionHandler class? How would you do it better?
I have this program in which I am trying to store a collection of values into a list and session
Example:
valueCollection = (List<Values>)Session["Value"];
I want to do the front end in a way which will show a table with each row showing a label and textbox. This would be too simple to do obviously but I want it to show 4 rows of the table by default and then the user can select "add another" this will then add another row onto the table with a label and textbox exactly similar to the 4 default. Everytime the user selects "add another" the table increments by 1.
I have an ASP.Net app that retrieves a collection of roles for a given user. Each role is a string. There's rarely more than 2-3 roles for any one person.I wanted to store the colelction of roles in Session state to save the time accessing the DB on each request.I basically want to write code that checks if a given string exists in the collection to test if the user has that role or not.My question is...what's the best way to do this? Is an array the best collection to store the role strings in Session with? Or is a dictionary better? I figure an array will take less memory (I don't really need a key + value) although a dictionary might lookup faster.
View 4 RepliesI am creating a presentation on basis of some selected values and maitaning the selected values in a session variable named Session("userPref") in collection form.
Now I am opening a TablePreview.aspx page by javascript window.open() function.
On Page_Load of TablePreview.aspx I am reading some values of Session("userPref") and doing some operatons.
For saving the presentation I have created a page wizardsave.aspx.
Now I am opening the wizardsave.aspx from TablePreview.aspx by window.open() function for saving presentation, but on Page_Load of wizardsave.aspx. I found that some value from collection stored in Session("userPref") have lost.
i have two text boxes and one button in web form. I need to display the contents of text boxes in a datatable in the same form, when i click on the button.
How can i do this using session array. I need to store values in session array. and get back the values from session when i need .
Currently in an .aspx file, I am storing a value (filename that was created in that session) in an hidden text box. When the user clicks on the "Print" labeled Hyperlink control, it opens the file that was stored in the hidden text box control. But when the user goes to different screen (in the same session), I loose the filename value that is stored in the hidden text box control. So I would like to store the filename variable in a session variable. So that if the user leaves this .aspx file and comes back to this .aspx file I can load the value into the hidden text box from the session variable.
View 11 RepliesWhen the user logs in, I want to store his userID in the session with
HttpContext.Current.Session["UserID"] = 2354; (this is just a hard-coded example)
Then, when I run a page method, if I do
var test = HttpContext.Current.Session["UserID"];
will the variable test hold the value I stored when he logged in?
If this is a correct way of doing it, how do I access the session when I receive a call from a page method? I want to put the test =... line in a page method to identify which user the request is coming from.
I have a datalist that shows Label, Label2 and has 8 rows of data.
I would like to store the value in Label2 row 8 in a session variable... how can i do this in VB.net?
I am currently working on asp.net 3.5 with C#. In our application Link buttons are used in Grid to redirect page. means when user click on link from Home Page it will redirect to Job details and when user click on Job details link grid it will redirect to VehicleDetail page. My problem is how to store value on jobDetails page from which page user came. without using Session , Static variable when page is redirect.
View 5 Repliesi want to store a list of objects in session
List<ContentQueueLog> inactiveContent = GetInActiveContent(this.userID, this.visitorID);
when i store this list in sesssion it is stored but while trhying to get its null.
Does ASP.net MVC Uses Session internally to store the states ?
Wil MVC faile across Webfarms if session not managed properly ?
i am working on a web application. i have 10 textbox control, in the page and 6 check box control . i need to store all those values in a session. but storing such a big field value is nothing but to create more session values. but i dont want create more than one session variables. how should i do this.
View 1 RepliesCan i still store value in session if in browser cookie is disabled?
View 2 Repliesi have a list of fields that i would store for all the user session. I thought to create a class, insert the information in it and store the class in the session but i'm not sure this is the best way to do it (performances, etc). I should have a list of these informations that i can display in views, i can delete and i can update. How could i do this?
View 10 RepliesI need to store data from a form for recovery from the session.
Below is my rough first attempt for a generalized method for textboxes:
Load Session:
[code]....
However, it appears that the Controls collection is not working for me. What am I doing wrong?
this.Controls.OfType<TextBox>() yields no results at run time when I do a quick watch on it.
I'm trying to get asp.net to store viewstate in the session rather than bulking up the html.
Now i've read that asp.net comes with the SessionPageStatePersister which can be used instead of the default HiddenFieldPageStatePersister to do this. I was wondering how i go about dropping it in?
This is what i've got so far:
I think i need to create a PageAdapter that returns a SessionPageStatePersister from its GetStatePersister method, and somehow get the page to use this pageadapter. But Page.PageAdapter only has a getter, so i'm not sure how you set it.
See the 'remarks' heading here: [URL]
I'm am building an web application that needs to be able to scale.We want to store, an connection string, an object that says what organization the user is working on right now and the identity of the user.
We could serialize down this and send through the userdata property in the FormsAuthenticationTicket, but that feels to not be the optimal solution, cause its is 4-5 strings of data that is unncessesary, but the main issue is that we are sending an encrypted connectionstring to the user which we dosent want to.
So what are our options?Can ASP.NET Cache be our solution?, can we couple the expiration of the asp.net cache and the formsauthenticationcookie?
consider this scenario: a user on my website has a profileID. There are some pluginID's associated with this profileID.
E.g.: User1 might have 2, 3 and 5 plugins associated with his profile.
When the user logs in, I store the profileID of the user in a session variable cod. ON a certain page, the user tries to edit the plugins associated with his profile. So, on that page, I have to retrieve those pluginID's from the DB.
I have applied this code but this fetches only the maximum pluginID from the DB and not all the pluginID's.
[Code]....
I was trying to figure out how can I store multiple pluginID's in this session variable?
I have a list of objects that I want to bind to a gridview. Creating that list and binding it works fine for most of the public properties in that list.
There are some objects contained in each of those objects... for instance there is an Address object.
object.Address.Line1;
object.Address.Line2;
When I bind this to my gridview, I have no issues with stuff like object.DateRegistered, but how can I access things like object.Address.WhatEverProperty? I always get this error:
"A field or property with the name 'xxx.xxxx' was not found on the selected data source."
I am using session to strore code
if (!string.IsNullOrEmpty(Request.QueryString["c"]))
System.Web.HttpContext.Current.Session["Code"] = Request.QueryString["c"];
else
System.Web.HttpContext.Current.Session["Code"] = "GR";
Instead of session,now I want to use cookies.
I am using Visual Studio 2008.
I created a New Project ASP.NET Web Application.
I created a Textbox named VisitorName. The visitor puts in their name and it goes in VisitorName.Text
There is a Label that says "Which do you own?"
There is a RadioButtonList. It has Cat, Dog and None.
There is a button that says Add to list.
The button needs to add the results of the above items and put them in the list.
Now you keep adding people and their pets.
Once there are all entered you press send and I get the results for everyone entered during that session via email.
I have no database access and the information does not need to be stored in such a way.
I would like to use a datatable or datalist or something to that sort.
Oh and I would like the visitor to be able to click on a name in the table and edit the data using the form controls not in the datalist or datatable itself.