How To Use Multiple Session Objects

Jul 23, 2010

i want to use multiple session variables for single session i know how to use for multiple session variables i dont know

View 9 Replies


Similar Messages:

State Management :: How To Link The Objects Between Browser Session And Session Objects

May 10, 2010

Lets say I am doing a shoping cart. I authenticate the user with a session variable.For example:

If(Request.IsAuthenticated)
// Here I want to add to the shoping cart.
// Can I do the following
Session["Cart"] = "Washing Machine";
Now will this Session["Cart"] value which is washing machine here be unique to diff customers?

View 1 Replies

.net - Determine Which Objects Are Used In Session?

Aug 17, 2010

I have inherited a very large ASP.NET app that needs to be modified to use a State Server instead of in-proc sessions. I need to track down all classes used in session throughout the app and then determine if they can be serialized. Are there any tools that can be used to analyze the code to determine the classes used in session?

View 2 Replies

.net - Session Objects Not Updating?

Apr 27, 2010

I set a session object at one juncture in my code:

Session("my_name") = "Dave"

Later in my code I give the user a chance to update this object:

Session("my_name") = TextBox1.Text

I reload my page and display a little hello statement like this:

Label1.Text = "Hello" & CStr(Session("my_name"))

The result is: "Hello Dave" no matter what I change Session("my_name") too.

EDIT: Here is the a full code-behind I wrote up to demonstrated:

Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1)
If Page.IsPostBack = False Then
Session("my_name") = "Dave"
End If
Label1.Text = CStr(Session("my_name"))
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Session("my_name") = TextBox1.Text
End Sub

View 3 Replies

C# - How To Handle Array Of Objects In A Session

Apr 8, 2010

In the project I'm working on I have got a list List<Item> with objects that Is saved in a session. Session.Add("SessionName", List);

In the Controller I build a viewModel with the data from this session

[Code]....

and in my View I loop trough the list of Items and make a form for all of them to be able to remove the item.

[Code]....

When the post from the submit button is handeld the item is removed from the array and post back exactly the same viewModel (with 1 item less in the itemList).

return View("view.ascx", viewModel);

When the post is handled and the view has reloaded the value's of the html.Hidden and Html.Textbox are the value's of the removed item. The value of the html.Encode is the correct value. When i reload the page the correct values are in the fields. Both times i build the viewModel the exact same way.

View 1 Replies

Where To Place Code For Session Objects In App

Aug 21, 2010

I am getting a serialization error trying to use Session State Server instead of InProd. However, I can't figure out what is causing the error in session. I was given some code to add to the page to loop through the session object and figure out if each item in it is serializable. My problem is I don't know where to place the code in the ASP.NET page. In tracing through the code, the error just appears after steping through objects outside of the page and not when setting session. There must be some place that I can place the code on the page that is after all session objects are set but before the page will error. Where would that be?

View 2 Replies

C# - How To Store A List Of Objects In Session

Jun 24, 2010

i 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.

View 1 Replies

Difference Between Session And Application Objects?

Jan 19, 2010

I know that Session is for a single user , and application is for multi user purpose.The Data in the application object is shared. Right? Then how can access the application data from an another client.

if My concept is wrong then what's right?

View 1 Replies

Session Objects Are Not Removed After Timeout Period?

Feb 8, 2011

Why Session objects are not removed after Timeout period?

I am using Asp.Net 4.0 and Session state is configured as shown below.

<sessionState mode="SQLServer" cookieless="false" timeout="5"
allowCustomSqlDatabase="true"
sqlConnectionString="data source=.SqlExpress;initial catalog=App_SessionState;user id=sa;password=xxxxxxxx"/>

If I have not activity in browser for about 10 mins, shouldn't the Session object be removed. But after 10 mins I can still access the Session variable. Am I missing something here?

EDIT:

If I access a session variable after 10 mins as shown below shouldn't I get NULL

var myObj = Session["MyKey"] as MyClass;
mObj is not NULL after 10 mins.

View 3 Replies

Alter Session Objects But Atlerations Not Saving?

Jul 23, 2010

I am developing a website where the user enters data into a form. The user can then go back and edit the data that is saved in a session variable and then the data is resaved in that session variable in an arraylist. However, for some reason although the data is resaving it is resaving the original data. I know this as I tested the code without the remove request to the arraylist and the original data was just added to the bottom of the array. I wondering if anyone would know why the new data is not saving. Any help would be really appreciated as I have only been programming for a few of months. Some of the code is below.//The gridview shown on a page which lists the objects saved by the user which he/she can edit and edit is the only one I am concerned with here as the other works

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
OnRowCommand="EditPenaltyPointsGridview" >
<Columns>

[code]...

View 4 Replies

C# - Alternate Way To Store Large Dynamic Objects Instead Of Session?

Mar 29, 2011

I have a web application developed in .net 2.0 I am storing large business objects in session, which change frequently.

Some times I observe server error. Is this causing the error?

Is there any alternative way to store these objects?

View 3 Replies

MVC :: Updating Multiple Objects In A View?

Jan 25, 2010

I have a view that is based on a view model. This model has a single property called Entity, of type ServiceProvider, which is a Linq2SQL object. This object has relationships to 2 other objects Address and ServiceProviderGroup. In a HTML view I have textboxes that allow the properties of the Entity property to be changed and also the properties of the Address object related to it.

E.g: ViewModel.Entity.Code, ViewModel.Entity.Name, ViewModel.Entity.Address.City, etc, etc.

There is also a selectlist that will allow the Entity.GroupId (int) property to be changed. This defines a relationship to the ServiceProviderGroup class which is also accessible via a Group propery. (standard linq2sql back references)

The Edit[Post] method accepts an instance of this view model and all properties (on the Entity, Entity.Address properties) are set as expected. I then lookup the original object in the database and I also bring back the original address and group data.

E.G: entity => entity.Code == viewModel.Code && entity.Address.Id == viewModel.Address.Id && entity.Group.Id == viewModel.Entity.GroupId (I'm not looking at the code, but it's something similar to this)

Either way the original Entity, Entity.Address, etc, come back from the database. I then apply the changes from the view model to the original object using UpdateModel and everything is updated as expected. But, if I try to change Entity.GroupId, i.e. change the relationship on the entity to another ServiceGroupProvider object, I get an exception in the generated code of the ServiceProvider object.

This happens in the GroupId property of the ServiceProvider class (viewModel.Entity). When it reaches the line if(!this.HasLoadedOrAssignedValue) it enters the "if" statement and throws an exception. When the data is first read from the database it skips this part. But, when UpdateModel attempts to apply the new Entity.GroupId value it throws the exception.

View 2 Replies

C# - Can Access Viewstate And Session Objects At Unload Event Of Page

Jan 8, 2010

can we access viewstate and session objects at unload event of page.

View 2 Replies

C# - Is It Possible To Map Multiple DTO Objects To A Single ViewModel Using Automapper

Jan 24, 2010

I was wondering if it is possible to map multiple DTO objects to a single ViewModel object using Automapper?

Essentially, I have multiple DTO objects and would like to display information from each on a single screen in ASP.NET MVC 2.0. To do so I would like to flatten the DTO objects (or parts of them...) into the Viewmodel and pass said viewmodel to the view. If I had one DTO this would be easy, but I've never seen it being done with multiple. Obviously there are a number of roundabout ways to do this (outside of automapper), but this is the approach that I would like to take if possible.

View 1 Replies

C# - ModelBinder With Multiple Selection And Complex Objects?

Feb 22, 2010

I'm trying to bind the selections in a multiple selection SELECT, to an IList input in the controller.

<select name="users" multiple="multiple">
<option>John</option>
<option>Mary</option>

[code]...

View 2 Replies

MVC :: Creating Multiple Complex Objects With A Webform?

Mar 3, 2010

I have a form which I use to create an issue. WHen you post the form, the form elements are that of a custom DTO. The DTO is then used on my POST method to create the new entity. That all works fine.

However, I want to add the functionality to add multiple issues at the same time from the same view. In effect, the user would click something like 'Report Additional Problem', and an extra set of form fields would appear (I will like use jquery for this, which I don't have an issue with). However, even with just leaving one set of form fields, the user should still be able to create just one issue. But if I habve my post method take a list or array of my DTO, it doesn't work.

Here is the post method before editing:

[Code]....

What I want to do is for this to take an array or list of NewIssueDto. I would then loop through each one in the list and create a new issue from it.

View 3 Replies

State Management :: Session Objects Not Cleared As Expected After Upgrading To IIS7.5?

Sep 13, 2010

I've just upgraded my development machine from XP SP3 (IIS5.1) to Win7 x64 (IIS7.5)

Since doing this, my app has started to behave differently. Within it I store users' preferences/access levels using an instance of a class that I store within the Session object. This class is shown:

[Code]....

My requirement is that on each page request (other than the login page), the application should check that the Session object exists. The page data is therefore shown based on the values within the session object (e.g. which customer account they are using etc)...Previously on IIS5.1 if I was logged into the app, but made some changes to a file within App_Code, or Web.Config for example, when I then continued to use the app, I would get kicked out to the login page straight away. This is the intended behaviour. Now however, on IIS7.5, the app continues to provide access to the pages, but debugging shows that the session value has had all of its values set to 0 (zero). Therefore, the pages continue to load but the data shown is corrupted because the app no longer displays it accurately. Here is the code I use which (on IIS5.1) caught this occurence. Can anyone offer any advice on just what's now happening

[Code]....

I have tried changing this line:

[Code]....

View 11 Replies

State Management :: Objects In Session Variables Now Causing Slow-downs?

Oct 24, 2010

I've noticed that once I've instantiated 3-4 objects now, my ASPX page is running slower. The response from the server (which is my own PC) is taking longer.

With one or two objects, the performance is same. After I instantiate 3, it slows a little, and 4 just completely wears it down.

I've read this article: [URL]

that says to avoid using session variables especially storing objects into them. Well thats exactly what I'm doing. My object has about 10 methods(~30 lines of code each) and 20 fields.

My question is, if I want to persist object in memory for each user session, how else could I store them on each postback if not in the session variable>? I can't use application variable because thats shared and not thread safe.

View 3 Replies

MVC :: Pattern For EF 4.0 CRUD / Transactions When Updating Multiple Objects?

Nov 17, 2010

I am looking for an accepted pattern for using MVC 2 and EF. Especially I am interested on how to implement updates. Where should the ObjectContext be created, where should the queries be, how to pass a model object from the controller and have it persisted with minimum robust code. I also want to be able to use transactions when updating multiple objects.

I used Linq in an asp.net application (code behind model). With EF I was hearing it was much more n-tier friendly, but I don't find it any different, rather than people talking about POCO which to me, all it means is satisfying the desire of those that want to have control of every piece of code being created.

View 6 Replies

MVC :: Handle Strongly Typed Views If Have Multiple Objects/models?

Mar 16, 2011

<p>Hi</p> <p>I'm a newbie in MVC but a veteran web forms developer. I really like the idea of strongly typed views but what if I have multiple objects to pass to my razor view. Would I then NOT use strongly typed views and just use the ViewBag?</p>

View 3 Replies

Caching - What Techniques Should Be Used To Handle Objects In Asp.net Cache To Prevent Problems From Multiple Worker Threads Access

Sep 8, 2010

since asp.net contains multiple threads that are executing at the same time.so if 2 threads access an object (simple or complex) that i got from the the asp.net httpcontext Cache.can't this lead to state problems on that object if these 2 theads tried to modify/read it at the same time?so what kind of precautions should i implement?for example i am thinking maybe locking the object while working with it? (wont this cause performance problems?)or maybe when i retrieve some object from the cache i should create a copy from it?
or maybe i dont need to worry about this issue at all?

View 2 Replies

Forms Data Controls :: Binding A Repeater To A List Of Objects That Have Child Objects?

Nov 17, 2010

have some Objects, lets say Employee and Role defined as below and I have defined relationships in my database that gives me a list of objects say employees and thanks to my framework each employee object also has a Role object linked via the RoleIDID, UserName, Password, Email, RoleIDRoleID, RoleNameSo in code I can do something like this

Employee emp = dataService_GetEmployeeByID(1);
string RoleName = emp.Role.RoleName;

Now here is my problemI can bind any object in a repeater and it works fine for the first level in my relationship

For instance <%# Eval("UserName") %>

But I need to be able to show the details for my child objects as well (Role) so something like this (which does not work)

<%# Eval("Role.RoleName") %>

View 2 Replies

Forms Data Controls :: Binding An Objects(containing Sub Objects) To A Dropdown List?

Apr 6, 2010

I know how to bind a simple objects to a dropdown list. However I am having problems binding my objects which contains sub objects to the control.i.e. with simple object i just do ddl.DataValueField = "myproperty"
with my objects they contains sub objects which i want to bind. I have tried ddl.DataValueField = "sub-object.myproperty" which doesnt work.

View 2 Replies

Architecture :: Using Static Methods To Build User Objects And Various Other Objects?

Jun 21, 2010

firstly a static class only ever exists once and is not an instance. Any static members (ie static int NoOfPeople;) is stored in one place and is shared between all sessions (like the old global variables).
Now static methods is where i'm not 100% sure. If I have a static method that doesn't use any other static members could this cause inconstant results, example (this is a fairly pointless method but just a quick example of the top of my head)

[Code]....

So in this example if two sessions (or threads) were to call this at the same time - would they both get back the expected results, because the method only uses private data (a, b and totalToReturn).Im sure this sounds a little simple but I will be using static methods to build user objects and various other objects that there will have to be a 100% garentee that the objects will not get mixed up between sessions and the wrong things return to the user.

View 5 Replies

State Management :: Manage Custom Objects And Session State?

Oct 6, 2010

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:

onload:

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

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved