session-state

How to configure SQL Server to manage ASP.NET sessions

我怕爱的太早我们不能终老 提交于 2019-12-18 07:22:29
问题 I need to know how to configure the .config to manage Session state in SQL Server 回答1: First you need to create a Session database. In order to do this: Look for the aspnet_regsql.exe Run this command aspnet_regsql.exe -S [ServerName] -E -ssadd -sstype p Where ServerName is your server name. This will create this database ASPState Now the configuration on the web.config Add this sentence over <sessionState allowCustomSqlDatabase="false" mode="SQLServer" sqlCommandTimeout="7200"

IE11 does not send session cookie when a link targeting a new tab is clicked (on first request)

痴心易碎 提交于 2019-12-18 04:35:07
问题 I am having some trouble holding onto session when opening an initial new tab (target _blank) from IE11. When I close all instances of IE11 and then open a fresh browser and navigate to the test webpage (default.aspx) the page stores a value in session and displays the session ID on the page. If I refresh the page the session ID stays the same. The page has a link to itself (default.aspx) with a target of _blank. If I click this link a new tab is opened, but the session ID is different. If I

Allow only one concurrent login per user in ASP.NET

会有一股神秘感。 提交于 2019-12-18 03:17:12
问题 Is it possible to allow only one concurrent login per user in ASP.NET web application? I am working on a web application in which I want to make sure that the website allows only one login per user at a time. How to check that the current user already logged in or not? Please suggest proper login method by which we can handle this problem. I think we should use SQL Server session state to handle this problem. What do you suggest? I thought of one solution for it. We can do something like:

Writing to a read only session in MVC 3+

落爺英雄遲暮 提交于 2019-12-18 03:03:10
问题 I've come across a curious behaviour of ASP sessions. You can force a controller to be outside of the user's session - I want to be able to do this so that multiple requests can execute at the same time and using a session causes them to execute consecutively. Disabling session state works as expected: [SessionState(SessionStateBehavior.Disabled)] public class SampleController : Controller { public ActionResult Test() { // Access to the session should be denied object test = Session["test"];

Getting session in .NET ASMX web-service

狂风中的少年 提交于 2019-12-17 19:32:44
问题 I have an ASMX webservice hosted alongside my ASP.NET web app. Now, I need to get the users session into the Webservice. To test this I made this simple method: [WebMethod(EnableSession = true)] public string checkSession() { return HttpContext.Current.Session["userid"].ToString(); } So, first I login to my web app, then in the browser goto my webservice and click "checkSession" on that auto generated test page. I have tested this on 3 computers. All 3 of those work fine with the webapp(so

Scaling up the ASP.NET session state server

半腔热情 提交于 2019-12-17 18:43:56
问题 Scenario: The website is hosted on three servers using IIS on each. All three servers are clustered using the network load balancing software that comes with Windows Server 2003. All three sites are configured to store the session state on a separate server that has been designated as a "state server". I have been asked to scale up the "state server". Is there a way that I can have more than one state server and synchronize state between them, so if one of the state servers goes down the

ASP.NET session state and multiple worker processes

匆匆过客 提交于 2019-12-17 15:36:33
问题 I need to understand something about ASP.NET session state, as it applies to IIS 7 and ASP.net 3.5. If an application is configured to use in-process session state, will that work OK if there are multiple worker processes? In other words, do worker processes share session state? The default configuration for IIS 7 is to use in-process session state and to allocate a maximum of 10 worker processes. It would seem likely then, that this default configuration should work. I'm dealing with a

“HttpContext.Current.Session” vs Global.asax “this.Session”

蓝咒 提交于 2019-12-17 10:52:08
问题 Recently, while working on some code for an ASP.NET project at work. We needed a tracking util to take basic metrics on user activity (page hit count etc) we would track them in Session, then save the data to DB via Session_End in Global.asax. I began hacking away, the initial code worked fine, updating the DB on each page load. I wanted to remove this DB hit on each request though and just rely on Session_End to store all the data. All of the tracking code is encapsulated in the Tracker

“HttpContext.Current.Session” vs Global.asax “this.Session”

我只是一个虾纸丫 提交于 2019-12-17 10:51:16
问题 Recently, while working on some code for an ASP.NET project at work. We needed a tracking util to take basic metrics on user activity (page hit count etc) we would track them in Session, then save the data to DB via Session_End in Global.asax. I began hacking away, the initial code worked fine, updating the DB on each page load. I wanted to remove this DB hit on each request though and just rely on Session_End to store all the data. All of the tracking code is encapsulated in the Tracker

IRequiresSessionState vs IReadOnlySessionState

风格不统一 提交于 2019-12-17 09:33:26
问题 What is the difference between IRequiresSessionState and IReadOnlySessionState beside the inability of the second to save changes to the session variables? Both provide me the ability to access session variables in my HttpHandler . But why would I prefer IReadOnlySessionState ? It just restricts me from saving the session for the next request. Or does it gives me an performance advantage over IRequiresSessionState ? When would I prefer to use IReadOnlySessionState over IRequiresSessionState ?