session-state

HTTP and Sessions

妖精的绣舞 提交于 2020-01-06 08:19:08
问题 I just went through the specification of http 1.1 at http://www.w3.org/Protocols/rfc2616/rfc2616.html and came across a section about connections http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8 that says " A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior of any HTTP connection. That is, unless otherwise indicated, the client SHOULD assume that the server will maintain a persistent connection, even after

accessing SessionState in Global.Application_Error

瘦欲@ 提交于 2020-01-05 08:14:37
问题 In the Application_Error method in Global.asax I am trying to retrieve a value from session state. I am able to access session state as long as I throw the exception. EG: thow new Exception("Test exception"); However if it is an unhandled exception, i get the following error when trying to access session state: "Session state is not available in this context.". Why the differences in behavior, is there a work around? Thanks. 回答1: I hate ASP.NET sometimes... So generating an error using:

Serializing IQueryable<T> to session state server

风流意气都作罢 提交于 2020-01-04 02:04:06
问题 How can I store a LINQ query (i.e. of type IQueryable<T> ) in SQL Server session state or any other State Server? 回答1: You can't serialize the IQueryable but you may be able to serialize the expression tree which generates that IQueryable . Check out the following question and associated MSDN link. Can you Pass Func<T,bool> Through a WCF Service? http://archive.msdn.microsoft.com/exprserialization 回答2: You can serialize/deserialize manually the Expression that is associated to IQueriable

IE8 does not keep Session Variables

你说的曾经没有我的故事 提交于 2020-01-03 14:16:23
问题 If I host an ASP.NET page with: <%@ Page Language="C#" %> <!DOCTYPE html> <script runat="server"> protected void btn_Click(object sender, EventArgs e) { lbl.Text = HttpContext.Current.Session["a"] == null ? "null" : HttpContext.Current.Session["a"].ToString(); } protected void btn_Click2(object sender, EventArgs e) { lbl.Text = HttpContext.Current.Cache["a"] == null ? "null" : HttpContext.Current.Cache["a"].ToString(); } protected void Page_Load(object sender, EventArgs e) { if (!Page

MVC3 Session timeout after 10 seconds

[亡魂溺海] 提交于 2020-01-03 03:07:07
问题 Need some help with a Session timeout problem in an ASP.Net web app. Essentially the session expires about 10-15 seconds after login. Side Note: I use a custom combo of FormsAuthentication and basic security My Session.IsNewSession gets set to true after 3-4 good postbacks after login. My Web.Config has the following... <sessionState mode="InProc" timeout="130" regenerateExpiredSessionId="true" stateNetworkTimeout="120" compressionEnabled="true" cookieless="UseCookies" /> <authentication mode

Use Session ID from supplied parameter instead of default behavior in ASP.NET MVC3

六月ゝ 毕业季﹏ 提交于 2020-01-02 23:09:31
问题 I am writing a simple proof-of-concept web service using ASP.NET MVC3 controller with JSON input/output. I want to allow a login based on a DB table and to return an API key and a session ID . With subsequent requests to other APIs I require passing both API key and a session ID. How can I set up my MVC3 project so that neither cookie nor cookieless session is being used. I want the session ID from JSON request to be used instead and still have the convenience of a Controller.Session . Is

Use Session ID from supplied parameter instead of default behavior in ASP.NET MVC3

点点圈 提交于 2020-01-02 23:09:12
问题 I am writing a simple proof-of-concept web service using ASP.NET MVC3 controller with JSON input/output. I want to allow a login based on a DB table and to return an API key and a session ID . With subsequent requests to other APIs I require passing both API key and a session ID. How can I set up my MVC3 project so that neither cookie nor cookieless session is being used. I want the session ID from JSON request to be used instead and still have the convenience of a Controller.Session . Is

Android Storing User Session in Shared Preferences

醉酒当歌 提交于 2020-01-02 12:26:51
问题 I want to create a User Session on Android so that i do not have to login every time. What content should be stored in Shared Preferences so that i can authenticate every time my server gets a request from the user i can make sure people are not hacking into my system. The users can login via the following in my app Facebook Google Do i need to convert and store some encrypted data in Shared Preferences ? Or just Storing the users Email or Username should be enough. 回答1: Its easy to store the

Android Storing User Session in Shared Preferences

天涯浪子 提交于 2020-01-02 12:25:11
问题 I want to create a User Session on Android so that i do not have to login every time. What content should be stored in Shared Preferences so that i can authenticate every time my server gets a request from the user i can make sure people are not hacking into my system. The users can login via the following in my app Facebook Google Do i need to convert and store some encrypted data in Shared Preferences ? Or just Storing the users Email or Username should be enough. 回答1: Its easy to store the

ASP.NET 5 (Core): How to store objects in session-cache (ISession)?

你离开我真会死。 提交于 2020-01-01 08:05:30
问题 I am writing an ASP.NET 5 MVC 6 (Core) application. Now I came to a point where I need to store (set and get) an object in the session-cache ( ISession ). As you may know, the Set -method of ISession takes a byte-array and the Get -method returns one. In a non-core-application I would use the BinaryFormatter to convert my object. But how can I do it in a core-application? 回答1: I'd go with serializing the objects to JSON and use the extensions methods on ISession to save them as string 's. //