Cookies And The Session State Object?
Mar 29, 2011
my main concern is using Session. I've always been under the impression that if you use the following statements (not that I would):
Session["newVar1"] = "a new session variable";
Session["newVar2"] = "a new session variable";
Session["newVar3"] = aLargeVariableThatHoldsLotsOfData;
You would be creating 3 new session cookies that hold the particular value. But I think my asp book is indicating that you would actually create 3 new variables in your session state object and ASP would only pass a unique Session ID (as a cookie?) in the response, and would get this ID upon the next request and associate that ID with your Session State Object (that IIS has stored in memory..?):
[code]....
That doesn't seem ideal for a website with lots of traffic. A server that is storing and maintaining thousands and thousands of instances of session state per website seems like way too much overload.
I'm trying to see what's going on on my own, but I'm having trouble.. I can't find my site's cookies anywhere on my machine (IE/windows xp). I've checked C:Documents and Settings icholasrCookies and C:Documents and Settings icholasrLocal SettingsTemporary Internet Files which, according to this yahoo answer, IE cookies are stored as well. I'm using ticket authentication in my app which stores a auth cookie on the client, so a cookie from my site has to be somewhere..
View 1 Replies
Similar Messages:
May 12, 2010
i have 3 pages, lets say pageA, pageB and pageC.
1 . From "pageB", i'm sending some data to "pageA" and and retriving the result with using HTTPWebRequest and HTTPWebResponse classes. I have no problem with this
2. pageA fills some session data, like Session["CustomerInfo"] .
3. After retrving some data from "pageA", I'm redirecting from "pageB" to "pageC".
At PageC, i want to use session variables which i fill at "pageA":
At pageB, i get the CookieContainer of the HTTPWebRequest object and it retrives correct SessionId.
And here is the code that redirects pageB to pageC:
Response.Cookies.Clear();
Request.Cookies.Clear();
foreach (Cookie cookie in SessionCookieContainer.GetCookies(new Uri(http://localhost/bla/bla)))
{
Response.Cookies.Add(new HttpCookie(cookie.Name, cookie.Value));
Request.Cookies.Add(new HttpCookie(cookie.Name, cookie.Value));
}
//Response.Redirect("../Default.aspx");
Server.Transfer("../Default.aspx",true);
At pageC , Request.Cookies and Response.Cookies are set truly, as i sent them from pageB, but there is nothing in the session. Session.Count is zero. And SessionId is different from the value which is stored in cookies.
View 4 Replies
Aug 5, 2010
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.
View 8 Replies
Dec 21, 2010
I have 4 webpages. In those pages, i am using session variables,viewstates,cookies. I am passing session variables,viewstates to different pages. Now the problem is sometimes i am getting the old cookie values or session values. I want to clear all these things when i close the browser or if i open a new tab of browser.
View 10 Replies
Aug 10, 2010
using ASP.NET 2.0 VB.NET how to detect if the session cookies are enabled?
I know how to detect the cookies in general but you can set IE to block the cookies and accept the session cookies...How to detect this?
View 2 Replies
Nov 20, 2010
how to create a logout page that clears the session and cookies??? using c# .net...
View 5 Replies
Oct 7, 2010
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.
View 3 Replies
Nov 9, 2010
[Code]....
View 3 Replies
Feb 11, 2011
On my local machine I've got a website running which uses the login control to authenticate a user and write a formsauthentication ticket to the client (which is also on the same local machine). At the login process it stores a a small serializable userobject in a session object named Session["appuser"]. Now when I open FF and login to the website all is fine so far... But here's the thing I cannot for the life of me figure out...
When I open IE8 and login to the same website, the session object which was created in FF is completely overwritten with the one created in IE. I thought that every session is unique, but now I'm really starting to feel my knowledge of sessions is almost next to nothing... Is there anyone out there that could tell me why I'm seeing this.
View 10 Replies
Sep 7, 2010
how I can know if a session object was never instantiated?
View 1 Replies
Apr 26, 2010
I have a object of Class named "Employee" I need to store the object in the session. what happens if i do not serialize the object and store in the session.
View 7 Replies
Jan 27, 2011
I have a Authorizeclient.aspx.cs page where I set my session value.Authorizeclient.aspx is a blank page. HttpContext.Current.Session["nodeID"]="0". This session value changes from 0 or non zero which depends on the value returned by Database. If no value is returned I assign HttpContext.Current.Session["nodeID"]="0" as the default state else I assign HttpContext.Current.Session["nodeID"]=resolve(nodeID).ToString()
Till this part it works fine as expected. However, I have a requirement that I need to read the nodeID from Session in other application on the same server. I mean this application too is part of the root project where I initially created the Session and set it. The strange thing is the Session["nodeID"] in application gets null "SOMETIMES" Not always. I am trying to read the Session in Page_Load. Sometimes it works fine and sometimes it gets null. Moreover the session object do not die and I can see other keys like Session["Themes"] etc there. The session is in InProc mode and have 20 minutes timeout time.
View 6 Replies
Mar 30, 2010
I am stuck with the issue of concurrent access to Session object. Actually my problem is i m writing to session in frame1 and trying to access that same Session object at the same time in Frame2's Page. I know about the reader/writer lock. I made the enablesessionstate = readonly in the page where i m writing to session. its giving me strange behavior on IE and firefox.
Its working concurrently in IE8 ( means page2 is diplaying modified values while page1 is changing the session object) but does not work in Firefox even page load is not called untill function on page 1 completed. Either anyone can fix my issue with firefox or there is new solution to reader/writer lock so that i can read the session at the same time while writing.
View 2 Replies
May 10, 2010
I have a asp.net application where I am saving off into session the user privilege information. From a grid I am bring up a new window by using the window.open. It seems that it is whiping out the values in session. A temporary bandaid I have placed on it is to recall the database if the value is nothing to reset the user object. I have found all over the internet that this is an issue with the window.open in IE 7 and IE 8. Has anyone else run into this and able to actually fix it?
View 4 Replies
May 21, 2010
System.InvalidCastException was unhandled by user code
Message=Specified cast is not valid.
Source=App_Web_donate.aspx.cdcab7d2.wqdohvu3
StackTrace:
at Donate.LoadUserDetails() in C:UsersSimonDesktopLocal SitesCats ProtectionNewDonate.aspx.vb:line 261
at Donate.btnDonate30_Click(Object sender, EventArgs e) in C:UsersSimonDesktopLocal SitesCats ProtectionNewDonate.aspx.vb:line 205
at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
I have made the important bits Bold I have the following code which is generating this error:
[Code]....
I am not entirely sure what is causing it. Its completley intermitent. I am storing all the details of a user filling in a form in a structure, and then assigning that structure to a session variable. This means if they page back, and then page forward again, I can pre-populate the form with the details they have already filled in for their conveinience by using the above code snippet. It appears that it works for a good minute, but if I leave the browser alone any longer than roughly 60 seconds, and then try and page forward to the form again, the exception will fire. While writing this post, the exception has occured in again in firefox, but interestingly, Google Chrome doesn't seem to have this problem. It looks like I can leave chrome alone for as long as I want and it will still work.
View 6 Replies
Sep 30, 2010
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.
View 4 Replies
Jun 30, 2010
my solution currently has a website project and a class library project. I am attempting to access a session object from my class library but it is always returning null. In a settings class in my class library I store these values like so:
private static SessionProperty<WebUser> _currentUser = new SessionProperty<WebUser>("CurrentUser", delegate { return new WebUser(); });
public static WebUser CurrentUser
{
get { return _currentUser.Value; }
set { _currentUser.Value = value; }
}
I can access this just fine from any aspx page codebehind like so:
Settings.CurrentUser.User.ProviderUserKey.ToString();
However, if I attempt to do the same thing from a class in my classlibrary project it always returns null.
View 5 Replies
Mar 9, 2011
I test my asp.net website app in my win 2000 server in Administrator user mode, the session I start (Session("user_ses") = myclass) only lasts a few seconds. But if I do the same as a 'common' user the session lasts 20 minutes, which is the time I set in web.config file:
<sessionState mode="InProc" cookieless="false" timeout="20" />
which is the reason the session lasts so little in Administrator user mode in windows 2000 server?
View 3 Replies
May 17, 2010
actually i got confused in session object,view state,application domain, can u tell me where i have to use these object. can u define some sort of condition in which session object must used & view state must used & diffrence of thses object where we can only use session & where i we can only use view state
View 2 Replies
Jan 30, 2011
The a way to save an object in session with expiry time , such as when you're saving object in cache.
View 12 Replies
May 26, 2010
I am trying to pass a key value from one page to another, using VB.net and Visual Studio 2008 Professional. I am creating a session variable in one aspx page and trying to retrive the value in the second aspx page (Dircted to by a button with the postbackurl set) However, the session object is empty when I try to access it in the second page. If, however, i put a debug hold on the code which retrieves the variable, and examine the session object from the "locals" debug window, i see contents. When I then resume the application the code retrieves the value correctly. I am executing my code using the development server that comes with Visual Studio. Could it have something to do with that?
First Page:
[Code]....
Second Page:
[Code]....
View 4 Replies
May 3, 2010
While working with mutliple tabs of same browser, session varibles/object gets over written with latest one.
Scenario in my application:
I have to create new employee on first tab(tab #1), and updating existing employee details on second tab(tab #2).I stored employee other details in Session["dtInfo"], use it on saving the record.Now Session["dtInfo"] having details of latest tab created, i.e. tab #2. I tried to save record on tab #1, facing the problem of session gets over written.I had to check some vaules on OnInit and OnInitComplete event. But I get here wrong values in session.
View 3 Replies
Oct 26, 2010
I noticed that when i am debugging my web application in Visual Studio 2005 using IIS, after about 10-15 minutes of inactivity, when I do something in the application such as a postback, I get an immediate error saying: "object reference not set to an instance" and my code breaks somewhere.Is my assumption correct that this is because my session has timed out? ( i do have a 15 minute default session time)my next question is, how do I display or set a way so that like many other pages, when the session has expired, a message will say: "This page must be refreshed" or "Your session has expired, click okay to refresh page" and start over again?
View 1 Replies
Jul 15, 2010
Is there any way to monitor asp.net session state in order to watch object size, or is there any other practice to find out a way to lighten asp.net session?
View 1 Replies
Jun 4, 2010
Ive created an object and placed it in the session, then in my .ashx handler I want to get that object from the session. The problem is that its always null !
heres how ive placed the object into the session from an aspx page
[Code]....
View 4 Replies