session-state

ASP.Net Store User Password in Session cookie?

不想你离开。 提交于 2019-12-04 03:17:56
问题 I know the Membership provider stores the user name and an expiration time in an encrypted cookie and then uses that to verify the user is still logged in for a session. Would it be possible to store the users password in this encrypted cookie as well. If so how would you access it server side? I need the users username and password available server side because I need to call web services that use those same credentials. Is there some better way to do this? 回答1: You should store it in

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

放肆的年华 提交于 2019-12-04 01:56:34
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? I'd go with serializing the objects to JSON and use the extensions methods on ISession to save them as string 's. // Save var key = "my-key"; var str = JsonConvert.SerializeObject(obj); context.Session.SetString(key, str); //

How to clear SQL session state for all users in ASP.NET

守給你的承諾、 提交于 2019-12-03 17:00:55
I use SQLServer SessionState mode to store session in my ASP.NET application. It stores certain objects that are serialized/deserialized every time they are used. If I make any changes in code of the structure of those objects and I put a new version live, any logged user will get an error, as their session objects (the old version ones) do not match the structure that the new version expects while deserializing. Is there a way to clear all sessions at once in DB so that all active sessions expire and users are forced to log in again (and therefore all session objects are created from scratch)

Why Asp.net MVC4 can not use the cookieless of SQL Server Session state storage

半城伤御伤魂 提交于 2019-12-03 16:44:53
ALL, Here is my web config in a Asp.net MVC4 application. I found if I set cookieless false ,everything goes fine. but If I don't want use cookie . then the application can not work.when I debug the application, I found the controller can not receive any request from the view. I think It is because when in the cookie-less mode, Something would be appended to the url before . like http:/ /localhost:8119/(S(3cicpjpagvpunr5he5fnfrj1))/. <configuration> <configSections> <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web

ASP.NET Session State Performance Benchmarks

你说的曾经没有我的故事 提交于 2019-12-03 16:40:42
问题 I have found a lot of great information comparing InProc, StateServer, and SQLServer for ASP.NET state management, but I can't seem find any performance benchmark comparisons. It is clear that InProc is faster than StateServer which in turn is faster than SQLServer, but it isn't clear how much faster. I realize that it's going to vary greatly by application and environment, but having a relative idea of how they compare would be valuable. Do you know of any benchmarks that have been performed

Pros and Cons of using ASP.NET Session State Server (instead of InProc)?

▼魔方 西西 提交于 2019-12-03 16:08:52
问题 Before I start using Session State server for the benefit of making session state more robust in my apps compared to InProc state, I'd like to find a list of Pros and Cons for evaluation. Update 1 : Also about surviving application pool recycles? Update 2 : What about longevity of sessions and their endings? 回答1: Here's the canonical analysis of the pros and cons of your three options, from Rob Howard's ASP.NET Session State article: In process . In process will perform best because the

RequestAcquireState Hanging on .NET 4.5.1 IIS8

家住魔仙堡 提交于 2019-12-03 14:45:27
Under heavy load or when using jQuery's ajax abort function, we see requests build up in IIS to the point where no-one can connect and the entire site hangs, forcing a recycle. A similar post from 3 years ago had a similar issue with .NET 4.5 and IIS 7.5 but Microsoft have stated this was fixed in 4.5.1 and released a patch for 4.5. This problem on Windows Server 2012R2 using IIS 8 when trying to use State Server and even more so when using State Server on development machines running Windows 10 and IIS10. The patch cannot be installed on any of these machines as the installer is blocked by

strongly typed sessions in asp.net

巧了我就是萌 提交于 2019-12-03 14:29:09
Pardon me if this question has already been asked. HttpContext.Current.Session["key"] returns an object and we would have to cast it to that particular Type before we could use it. I was looking at various implementations of typed sessions http://www.codeproject.com/KB/aspnet/typedsessionstate.aspx http://weblogs.asp.net/cstewart/archive/2008/01/09/strongly-typed-session-in-asp-net.aspx http://geekswithblogs.net/dlussier/archive/2007/12/24/117961.aspx and I felt that we needed to add some more code (correct me if I was wrong) to the SessionManager if we wanted to add a new Type of object into

is it a good idea to create an enum for the key names of session values?

泪湿孤枕 提交于 2019-12-03 13:15:21
instead of doing session("myvar1") = something session("myvar2") = something session("myvar3") = something session("myvar4") = something is doing enum sessionVar myvar1 myvar2 myvar3 myvar4 end enum session(sessionVar.myvar1.tostring) = something session(sessionVar.myvar2.tostring) = something session(sessionVar.myvar3.tostring) = something session(sessionVar.myvar4.tostring) = something would be better? Instead of using constants for the session keys, I'm using my own type-safe session object, which looks like this (sorry this is in C#, see below for a VB version): public class MySession { //

Android — How to properly handle onPause/onResume methods?

半世苍凉 提交于 2019-12-03 12:55:34
问题 I have an app that starts playing sounds and begins/resumes gameplay in the onResume() method, but what I'm noticing is that if my app was the last run application when I put the phone into standby (screen off), and I just press the Menu button to check the time, then the phone starts playing the game and sounds in the background (the app isn't actually visible, only the screen with the date/time is, yet onResume must have been called in my app). What am I to do here? Is there a way to