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
Similar Messages:
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
Aug 27, 2010
I want to know why we must set the serializable attribute to save an object in view state.
Also, which type of objects can we store in view state?
View 5 Replies
Jan 14, 2010
This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible.
I'm creating some classes to simplify some tasks for some specific requirements we have in some projects at work.
I have a class that creates objects which maps the values from webcontrols to an object properties similar to this
[URL]
The problem I have it's sometimes I have to store a non container object in a place (in an object's attribute) and sometimes I have to a store a container object in the same place for storing the values of a webcontrol (a webcontrol can sometimes hold several values like a checkboxlist). I dont like this at all, because some time ago when working in a non commercial compiler, when parsing and generating the intermediate code I had sometimes to store a container in a place, and sometimes I had to store a non container in the same place, and having to ask in other parts of the code if what you are reading is this type of object, or this another type of object, it is something really annoying and it mess up the code. Is there any tips about what it would be better to do to avoid this kind of situations or nothing can be done to avoid it sometimes?
View 3 Replies
May 3, 2010
which place(exact folder) the session & session id will be stored?
View 8 Replies
Feb 25, 2011
If I have a subroutine in codebehind called:
Subroutine1
and I store it in a session:
Session("tempSub") = "Subroutine1"
How can I then pull it out of the Session and call it?
something like this, but it doesn't work.
Dim tempSub as object = Session("tempSub")
tempSub()
Which would actually be subroutine1() if it actually worked.
View 3 Replies
Feb 15, 2011
(I have a feeling i'm making a mental error thinking this is possible, because it seems too easy, but here goes)
For my intranet web app with 20 users on slow machines, the view state is slowing down their browsers.
But the network is local and fast. So I think to myself, why bother putting all that data on the user's browser?...Something like putting it in the database and then all the page needs to maintain is a unique key. But then I remembered that's how session state pretty much works.
QUESTION: Am I missing something or is this really possible?
View 2 Replies
Feb 1, 2010
I an using Session for storing UserName for whole project. But it always time out before 20 min. I want set value in properties and want to use in project but when my page is loading again its showing null value.
How can i save this value in this?
Code what i am using.
public string UserName {get; set; }
public string Password {get; set;}
View 2 Replies
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
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
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
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
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
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
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
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
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
Dec 11, 2010
I have some code in a button_click event in my webform that performs some actions
(writing some xml files).But i wish to place all my XML code in 1 class within my webproject.But how do i exactly acces controls from my webform on this class?nd how do i link those 2 with each other?Ive tried inherit from System.Web.UI.Page in my class but seems thats not quite it.
View 1 Replies
Jul 8, 2010
I have three grids in a table. These three grids have three refresh buttons Ref1, Ref2, Ref3 attached to each other respectfully.
Now i want to click the first Ref1, then my first grid will be refrehed and the <iFrame> opaqueness whould be covering the first grid only.
View 13 Replies
Jan 8, 2010
can we access viewstate and session objects at unload event of page.
View 2 Replies
Nov 23, 2010
Is it possible to place .net code inside of a .html webpage?
View 3 Replies
Oct 19, 2010
I want to find a place to put my Google Analytics code in my ASP.NET web application. I would like to place it somewhere once and not have to copy and paste the code into multiple files. Is there somewhere that I could inject it that I would only have to include it once and all pages would be effected? I am not using MasterPages unfortunately.
View 6 Replies
Aug 9, 2010
I wish to place a sub in the code behind of my master page, that will be used to assign variables used in the content pages based on query string values. I would like to see advice on general syntax as it relates to the relationship between master pages and their content pages.I would much rather pursue this route as opposed to repeating the same code on every content page.
View 1 Replies
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
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