Commit Graph
62 Commits
Author SHA1 Message Date
Miguel de Icaza be4686b9d9 Merge pull request #594 from Adeath56/patch-1
System.Web.dll : NullReferenceException on GetItemInternal() after a Session.Abandon()
2013-03-08 16:37:28 -05:00
Carlos Alberto Cortez 70927ed41c [System.Web] Re-enable SessionStateModule.OnSessionExpired as needed.
SessionStateModule.OnSessionExpired is used as a callback for its
'handler' field (SessionStateStoreProviderBase.SetItemExpireCallback),
and is normaly enabled in Init, as well as disabled in OnReleaseRequestState
if the container is abandoned.

However, since the module may stay around being re-used, it may continue
working *without* this callback being invoked/enabled anymore -causing a number of
nasty, hard to debug side effects, as session data ending up in the void-.
So we enable this callback again in OnAcquireRequestState, which is the
point at where we know we have a brand new, working container.
2012-06-11 08:22:40 -05:00
J. Christopher Pereira cfc15c20af Update mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs 2012-03-08 05:28:43 -05:00
kripper 4388133908 Fixes BUG https://github.com/mono/mono/pull/229#issuecomment-4212737 2012-03-03 19:42:46 -05:00
Robert Jordan 4e87eb1631 [Web] Fix obvious typo in DELETE FROM WHERE statement. 2011-11-05 14:41:08 +01:00
Marek Habersack 50c4a1968f [asp.net] Don't throw an exception if a session item being released does not have a lock.
It can happen when the item is being released after its associated session has ended.
2011-05-24 11:12:43 +02:00
Marek Habersack 43e9f8ccc0 Fix compilation 2011-04-22 14:02:14 +02:00
Marek Habersack 68337d6ca1 [asp.net] Do nothing if null SessionStateStoreData is passed to SessionStateServerHandler.SetAndReleaseItemExclusive 2011-04-22 12:34:03 +02:00
Marek Habersack 0eff07d0fc [asp.net] Better handling of item timeout reset in the in-proc session handler
The in-proc session handler no longer removes and re-inserts an item in order to
update its timeout. It is now done using Cache.SetItemTimeout which, in turn, checks
whether the item being updated is already a timed one and, if yes, calls CacheItemPriorityQueue's
Update method for that item. Should the update fail or the item is not yet timed, the item is
enqueued to the priority queue in the regular fashion.

CacheItem got a new member, PriorityQueueIndex to mark its position in the queue's heap for faster
lookup and manipulation.

The CacheItemPriorityQueue.BubbleDown method was rewritten to properly swap items in the heap.
2011-04-11 14:48:13 +02:00
Marek Habersack d956508011 [asp.net] Fix for bug #669807. Cache session item locks as the item might be cleared before the lock needs to be released. 2011-02-21 19:49:51 +01:00
Gonzalo Paniagua Javier 5ab786b5b4 Get system.web/httpRuntime only once
Get that section only once and keep it in HttpRuntime.
2010-12-09 19:01:41 -05:00
Marek Habersack d65749c571 [asp.net] A few memory usage optimizations.
* System.Web.Caching/CacheItemPriorityQueue.cs: when the heap is resized, the old heap memory
  is cleared.
* System.Web.SessionState_2.0/SessionInProcHandler.cs: the session items collection is cleared
  when the InProcSessionItem is destroyed
* System.Web/HttpApplicationState.cs: instantiate SessionObjects and StaticObjects collections
  only on demand.
  Replaced ReaderWriterLock with ReaderWriterLockSlim.
  Removed a few variables which aren't needed.
* System.Web/HttpStaticObjectsCollection.cs: replaced a Hashtable with a Dictionary <string, object>.
  The objects dictionary is created on demand only.
2010-11-18 02:21:47 +01:00
Marek Habersack 8940995fc8 [asp.net] Cache + SessionInProcHandler memory usage improvements
* Cache.cs: cache removes old/least recently used items when the item count exceeds 15000. Items
  are removed until they reach the count of 10000.
* SessionInProcHandler.cs: replaced ReaderWriterLock with ReaderWriterLockSlim and added a Dispose
  method to the InProcSessionItem type which disposes the associated lock and other resources.
2010-11-13 04:14:33 +01:00
Sebastien Pouliot 21d2c6aedb A few moves/changes following previous patch review
* Makefile: Compile tests with TEST defined (to include System.Web.Util.
MachineKeySectionUtils unit tests)
* System.Web.dll.sources: Move MachineKeySectionUtils.cs from System.
Web.Configuration_2.0 to System.Web.Util
* System.Web_test.dll.sources: Move MachineKeySectionUtilsTest.cs from
System.Web.Configuration_2.0 to System.Web.Util

* System.Web.Configuration_2.0/MachineKeySection.cs: Adjust using
clauses. Uncomment some code. Fix TripleDES versus 3DES for Validation
under NET_4_0. Remove 'private' on fields/methods.
* System.Web.Handlers/AssemblyResourceLoader.cs: Adjust using clauses
* System.Web.Security/MembershipHelper.cs: Adjust using clauses
* System.Web.Security/RolePrincipal.cs: Adjust using clauses
* System.Web.SessionState_2.0/SessionId.cs: Adjust using clauses
* System.Web.UI/LosFormatter.cs: Adjust using clauses.
* System.Web.Util/MachineKeySectionUtils.cs: Moved from System.Web.
Configuration_2.0. Rename namespace and remove 'internal' on type
declaration

* Test/System.Web.Util/MachineKeySectionUtilsTest.cs: Moved from Test/
System.Web.Configuration/MachineKeySectionTest.cs. Add test case for
TripleDES versus 3DES
2010-10-12 11:38:48 -04:00
Sebastien Pouliot a22389fde2 Normalization of cryptographic uses in asp.net
* System.Web.Configuration_2.0/MachineKeyRegistryStorage.cs:
Remove key length check and generic key generation.

* System.Web.Configuration_2.0/MachineKeySection.cs: Add support for 4.0
ValidationAlgorithm and the use of custom algorithms (validation and
decryption). Allow the use of any, valid, key length (based on the
algorithm). Let each algorithm creates its own key (e.g. special needs,
default length...)

* System.Web.Configuration_2.0/MachineKeySectionUtils.cs: Remove key
generation (from random) code and 192bits key length hack (won't work
with custom algorithms). Add support for new (4.0) algorithms, including
custom ones. Provide uniform/shared code to Encrypt/Decrypt, Sign/Verify
and EncryptSign/VerifyDecrypt using MachineKeySection data.

* System.Web.Configuration_2.0/MachineKeyValidation.cs: Add new (4.0)
values.

* System.Web.Configuration_2.0/MachineKeyValidationConverter.cs: Add
support for new (4.0) algorithms.

* System.Web.Handlers/AssemblyResourceLoader.cs: Use the new common
cryptographic code and base64 the encrypted data.

* System.Web.Security/FormsAuthentication.cs: Use the new common
cryptographic code and base64 the signed and/or encrypted data.

* System.Web.Security/MembershipHelper.cs: Use the new common
cryptographic code - this should be 100% compatible with existing data.

* System.Web.Security/RolePrincipal.cs: Use the new common cryptographic
code.

* System.Web.Security/SqliteMembershipProvider.cs: Adapt code for
internal API change.

* System.Web.UI/LosFormatter.cs: Adapt code for internal API change.
Fix some small behaviro changes wrt NET_4_0

* System.Web.UI/ObjectStateFormatter.cs: Use the new common cryptographic
code.

* System.Web.UI/Page.cs: Remove code that is now unneeded (with the new
common cryptogrraphic code).

* System.Web.Configuration_2.0/MachineKeyCompatibilityMode.cs: New.

* Test/System.Web.Configuration/MachineKeyValidationConverterTest.cs:
Add more, mostly 4.0, test cases.

* Test/System.Web.Security/FormsAuthenticationTest.cs: Add test case to
ensure HashPasswordForStoringInConfigFile is not case sensitive.

* Test/System.Web.UI/LosFormatterTest.cs: Add some rountrip test cases
with the different ctors
2010-10-12 11:38:47 -04:00
Sebastien Pouliot e46106929b Remove unneeded 'using' clauses 2010-10-08 16:09:20 -04:00
Marek Habersack 7d5d241975 [asp.net] Fix for bug #629990 In-Proc session state must remove cache prefix from item key
When the in-proc session handler puts items in the internal cache, it prefixes them with the
@@@InProc@ prefix to make sure they don't conflict with other values stored there. The handler
has been failing so far to remove that prefix when triggering the session end event. This commit
fixes the issue.
2010-08-10 21:56:21 +02:00
Marek Habersack e105f08673 2010-03-04 Marek Habersack <[email protected]>
* BuildManager.cs: do less work in the static constructor

2010-03-04  Marek Habersack  <[email protected]>

	* RuntimeHelpers.cs: added. Contains methods moved here from
	HttpRuntime, so that initialization sequence of various objects is
	independent of HttpRuntime.

2010-03-04  Marek Habersack  <[email protected]>

	* HttpRuntime.cs: do less work in the static constructor. Most of
	the code was moved to System.Web.Util.RuntimeHelpers. Properties
	which have been moved: MonoVersion, RunningOnWindows,
	CaseInsensitive, IsDebuggingEnabled

Also:
	- hushed some compiler warnings
	- various classes now use RuntimeHelpers instead of HttpRuntime

svn path=/trunk/mcs/; revision=153038
2010-03-04 19:04:13 +00:00
Marek Habersack fe877b028d Fix the build
svn path=/trunk/mcs/; revision=152383
2010-02-24 18:32:15 +00:00
Marek Habersack f694564bc3 2010-02-24 Marek Habersack <[email protected]>
* SessionStateServerHandler.cs: added support for session state
    	compression (4.0)

2010-02-23  Marek Habersack  <[email protected]>

    	* SessionStateSection.cs: implemented 4.0 properties -
    	CompressionEnabled and SqlConnectionRetryInterval

svn path=/trunk/mcs/; revision=152378
2010-02-24 17:33:54 +00:00
Marek Habersack 38f8d2d40c 2010-01-20 Marek Habersack <[email protected]>
* SessionStateBehavior.cs: added (4.0)

2010-01-20  Marek Habersack  <[email protected]>

	* OutputCacheSection.cs: implemented the Providers and
	DefaultProviderName 4.0 properties.

2010-01-20  Marek Habersack  <[email protected]>

	* HttpContextBase.cs: implemented RemapHandler and
	SetSessionStateBehavior 4.0 APIs.

2010-01-20  Marek Habersack  <[email protected]>

	* HttpContext.cs: implemented the 4.0 SetSessionStateBehavior
	method

	* HttpCacheVaryByContentEncodings.cs, HttpCacheVaryByHeaders.cs,
	HttpCacheVaryByParams.cs : parameterless constructors are public
	in 4.0

	* HttpApplication.cs: implemented the 4.0
	GetOutputCacheProviderName method

svn path=/trunk/mcs/; revision=149934
2010-01-20 22:39:05 +00:00
Marek Habersack 77a61be80d 2009-10-19 Marek Habersack <[email protected]>
* ASPState.sql: added - schema for the SQL session state server
	database.

2009-10-19  Marek Habersack  <[email protected]>

	* SessionStateModule.cs: enabled SQL session state provider.

	* SessionSQLServerHandler.cs: implemented. Uses System.Data.Common
	for provider-agnostic implementation. Until an issue with Npgsql's
	2.0 factory missing is resolved it defaults to using
	Mono.Data.Sqlite as the provider.
	Selecting of the data provider is done by putting DbProviderName
	in the connection string specified in the
	<system.web/sessionState> configuration section.

svn path=/trunk/mcs/; revision=144412
2009-10-19 20:59:08 +00:00
Marek Habersack a7b1a2dd6f Removed 1.1-only directories:
- System.Web.Configuration
 - System.Web.SessionState

svn path=/trunk/mcs/; revision=143647
2009-10-07 13:31:42 +00:00
Marek Habersack 9a0870f6a1 Hush compilation warnings
svn path=/trunk/mcs/; revision=135050
2009-05-29 07:48:14 +00:00
Marek Habersack e47e456963 2009-03-21 Marek Habersack <[email protected]>
* HttpSessionState.cs: implemented the CookieMode property.

svn path=/trunk/mcs/; revision=129934
2009-03-21 02:12:29 +00:00
Marek Habersack ef9c9e51ce Do not abuse the 'private' keyword
svn path=/trunk/mcs/; revision=116539
2008-10-20 17:37:54 +00:00
Marek Habersack f3bc4a2f46 Use UNIX line endings consistently
svn path=/trunk/mcs/; revision=116241
2008-10-17 15:26:06 +00:00
Marek Habersack 4caac12664 2008-09-15 Marek Habersack <[email protected]>
* SessionStateModule.cs: correctly let the handler know if an item
	is new when calling SetAndReleaseItemExclusive. Fixes bug #424797
	If handler's GetItem doesn't initialize storeLockId to a non-null
	value, initialize it to 0. Fixes bug #424797

svn path=/trunk/mcs/; revision=112997
2008-09-15 09:54:30 +00:00
Marek Habersack 2a10f9ae73 2008-07-29 Marek Habersack <[email protected]>
* SessionStateModule.cs: use Request.FilePath instead of
	Request.BaseVirtualDirectory to retrieve the cookie-less session
	identifier. Fixes bug #397418

2008-07-29  Marek Habersack  <[email protected]>

	* UrlUtils.cs: fixed a typo in HasSessionId which made it always
	return False. Fixes bug #397418

2008-07-29  Marek Habersack  <[email protected]>

	* SessionStateModule.cs: use Request.FilePath instead of
	Request.BaseVirtualDirectory to retrieve the cookie-less session
	identifier. Fixes bug #397418

2008-07-29  Marek Habersack  <[email protected]>

	* HttpRequest.cs: if the FilePath contains embedded cookie-less
	session identifier, remove it before computing the base virtual
	directory. Fixes bug #397418



svn path=/trunk/mcs/; revision=109156
2008-07-29 13:01:55 +00:00
Marek Habersack ae00a7ec53 2008-06-04 Marek Habersack <[email protected]>
* SessionStateModule.cs: set the application modifier path to bare
	session id.

2008-06-04  Marek Habersack  <[email protected]>

	* UrlUtils.cs: added internal method HasSessionId

2008-06-04  Marek Habersack  <[email protected]>

	* SessionStateModule.cs: set application path modifier string to
	the bare session ID.

2008-06-04  Marek Habersack  <[email protected]>

	* HttpResponse.cs: correctly modify virtual path to include the
	session ID in cookieless session mode. Fixes bug #396628.

svn path=/trunk/mcs/; revision=104861
2008-06-04 13:13:09 +00:00
Marek Habersack 0907975508 2008-05-30 Marek Habersack <[email protected]>
* BaseDataBoundControl.cs, ChangePassword.cs, CustomValidator.cs,
	DataControlFieldCollection.cs, DataControlField.cs,
	PasswordRecovery.cs, PagerSettings.cs: do not use synthetized
	event accessors (to avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* AnonymousIdentificationModule.cs, FormsAuthenticationModule.cs,
	DefaultAuthenticationModule.cs, MembershipProvider.cs,
	WindowsAuthenticationModule.cs, PassportAuthenticationModule.cs,
	RoleManagerModule.cs: do not use synthetized event accessors (to
	avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* HttpApplication.cs, HttpCachePolicy.cs, SiteMapProvider.cs,
	TraceContext.cs: do not use synthetized event accessors (to avoid
	locks).

2008-05-30  Marek Habersack  <[email protected]>

	* SessionStateModule.cs: do not use synthetized event accessors
	(to avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* ProfileModule.cs: do not use synthetized event accessors (to
	avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* SessionStateModule.cs: do not use synthetized event accessors
	(to avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* DataBindingCollection.cs, ExpressionBindingCollection.cs: do not
	use synthetized event accessors (to avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* ClientBuildManager.cs: do not use synthetized event accessors
	(to avoid locks).

2008-05-30  Marek Habersack  <[email protected]>

	* CacheDependency.cs: do not use synthetized event accessors (to
	avoid locks).


svn path=/trunk/mcs/; revision=104569
2008-05-30 22:20:14 +00:00
Marek Habersack 76e412a4c5 2008-04-24 Marek Habersack <[email protected]>
* SessionStateModule.cs: reset the storage data item timeout to
	the HttpApplication.Session.Timeout value after the Session_Start
	event is fired. Fixes bug #382644

svn path=/trunk/mcs/; revision=101632
2008-04-24 00:38:24 +00:00
Konstantin Triger beb58ae31a TARGET_J2EE: reverted r80308
svn path=/trunk/mcs/; revision=95485
2008-02-12 09:30:34 +00:00
Igor Zelmanovich 6d244cc6a0 refactoring:
use Trace.WriteLine instead Console.WriteLine within #if TRACE.

svn path=/trunk/mcs/; revision=92786
2008-01-13 13:01:38 +00:00
Marek Habersack 222c5eb23c 2007-11-05 Marek Habersack <[email protected]>
* SessionStateModule.cs: use TimeSpan.TotalMinutes wherever a
	session timeout is required, so that sessions do not expire
	prematurely. Fixes bug #339026. Patch from Adriaan van Kekem
	<[email protected]>, thanks!

svn path=/trunk/mcs/; revision=88845
2007-11-05 09:40:29 +00:00
Marek Habersack ab0142ff0d Do not abuse the MonoTODO attribute
svn path=/trunk/mcs/; revision=87705
2007-10-17 19:13:40 +00:00
Marek Habersack b3c159c029 A slightly more elegant way of dealing with 'item==null' issue
svn path=/trunk/mcs/; revision=87637
2007-10-17 08:16:44 +00:00
Marek Habersack 603db366d7 2007-10-17 Marek Habersack <[email protected]>
* SessionInProcHandler.cs: in certain situations the 'item'
	parameter passed to SetAndReleaseItemExclusive may be null. The
	issue was reported in bug #333898, but the reporter cannot provide
	a test case that triggers the issue. Added work around the problem
	in the way that should have the least impact on the rest of the
	code. If 'item' is null, then the new session item is created
	without the items and staticItems collections - they will be
	initialized to defaults when retrieving the session item. This is
	not a correct fix, but since there is no test case this is the
	best what can be done right now.

svn path=/trunk/mcs/; revision=87636
2007-10-17 08:09:38 +00:00
Juraj Skripsky 9d8f783fc9 2007-10-15 Juraj Skripsky <[email protected]>
* SessionStateModule.cs (Init): Use HttpApplication.LoadType,
	don't swallow TypeLoadException.


svn path=/trunk/mcs/; revision=87504
2007-10-15 12:48:57 +00:00
Marek Habersack f1886327a3 2007-10-15 Marek Habersack <[email protected]>
* SessionStateServerHandler.cs: adjust order of field
	initialization.

svn path=/trunk/mcs/; revision=87493
2007-10-15 09:42:03 +00:00
Marek Habersack cdf8842f67 2007-09-18 Marek Habersack <[email protected]>
* SessionStateModule.cs: preserve the query part of the url when
            redirecting with cookieless sessions active. Fixes bug #318790
2007-09-18  Marek Habersack  <[email protected]>

            * SessionIDManager.cs: preserve the query part of the url when
            redirecting with cookieless sessions active. Fixes bug #318790

svn path=/trunk/mcs/; revision=85955
2007-09-18 08:38:35 +00:00
Marek Habersack 108381ac5f 2007-09-07 Marek Habersack <[email protected]>
* SessionInProcHandler.cs: properly clone the
            ApplicationState.SessionObjects at the start of the request and
            use the copy when creating new storage items. That way session
            scope static objects are valid within a single session only. Fixes
            bug #82709

svn path=/trunk/mcs/; revision=85460
2007-09-07 00:26:12 +00:00
Marek Habersack de3974edad 2007-08-14 Marek Habersack <[email protected]>
* SessionStateServerHandler.cs: remove unused field.

2007-08-14  Marek Habersack  <[email protected]>

	* Control.cs: include the actual exception when reporting control
	id clash.

2007-08-14  Marek Habersack  <[email protected]>

	* Roles.cs: remove unused field.

	* SqlMembershipProvider.cs: remove unused variable.

2007-08-14  Marek Habersack  <[email protected]>

	* ObjectDataSourceView.cs: remove unused variable.

	* ChangePassword.cs: remove unused variable.

	* RoleGroupCollection.cs: OnValidate shouldn't be overridden.

2007-08-14  Marek Habersack  <[email protected]>

	* SqlProfileProvider.cs: remove unused variable.

2007-08-14  Marek Habersack  <[email protected]>

	* XmlSiteMapProvider.cs: do not hide this_lock.



svn path=/trunk/mcs/; revision=84041
2007-08-14 10:52:59 +00:00
Marek Habersack ee53884fda 2007-07-31 Marek Habersack <[email protected]>
* SessionInProcHandler.cs: initialize the static session objects
	collection from the application state instead of using
	SessionStateUtility.GetSessionStaticObjects. Fixes bug #82193
	* SessionStateServerHandler.cs: as above
	

svn path=/trunk/mcs/; revision=83072
2007-07-31 13:39:46 +00:00
Igor Zelmanovich a9287ab15f 2007-07-30 Igor Zelmanovich <[email protected]>
* SessionStateModule.cs:
	ensure release (save) session state at OnEndRequest.	


svn path=/trunk/mcs/; revision=82975
2007-07-30 11:44:23 +00:00
Marek Habersack 0b80ac0b50 2007-06-20 Marek Habersack <[email protected]>
* OutputCacheModule.cs: use Context.InternalCache.

	* Cache.cs: 2.0 profile uses generic containers to keep the cache
	entries.
	Gotten rid of the InsertPrivate and InsertInternal methods. The
	latter was moved to one of the Insert overloads.
	Private entries are no longer handled specifically, because the
	internal cache is now kept in a separate object.

2007-06-20  Marek Habersack  <[email protected]>

	* AppResourcesCompiler.cs: use HttpRuntime.InternalCache to keep
	private entries.
	* CachingCompiler.cs: as above
	* AspGenerator.cs: as above

2007-06-20  Marek Habersack  <[email protected]>

	* DataSourceCacheManager.cs: use HttpContext.Current.InternalCache
	to keep private entries.
	* XmlDataSource.cs: as above

2007-06-20  Marek Habersack  <[email protected]>

	* SessionInProcHandler.cs: use HttpRuntime.InternalCache to keep
	private entries.

2007-06-20  Marek Habersack  <[email protected]>

	* SessionInProcHandler.cs: use HttpRuntime.InternalCache to keep
	the internal entries.

2007-06-20  Marek Habersack  <[email protected]>

	* BasePartialCachingControl.cs: use HttpRuntime.InternalCache to
	keep the private entries.

2007-06-20  Marek Habersack  <[email protected]>

	* HttpRuntime.cs: added new internal property, InternalCache, to
	keep all the internal cache entries instead of mixing them with
	the public cache ones.
	Do not invoke Cache.InvokePrivateCallbacks - this method no longer
	exists.

	* HttpResponse.cs: private entries are now kept in
	Context.InternalCache.

	* HttpContext.cs: added new internal property, InternalCache,
	which returns the HttpRuntime.InternalCache value.

Fixes bug #81690


svn path=/trunk/mcs/; revision=80321
2007-06-20 15:42:36 +00:00
Marek Habersack 19f92c957d 2007-06-20 Marek Habersack <[email protected]>
* SessionStateModule.cs: if session is abandoned and the handler
	supports expiration, disable the handler's session expiration
	callback and call SessionStateUtility.RaiseSessionEnd
	directly. Fixes bug #81853.

svn path=/trunk/mcs/; revision=80308
2007-06-20 11:58:14 +00:00
Marek Habersack 5eae577076 2007-04-30 Marek Habersack <[email protected]>
* SessionInProcHandler.cs: do not end session when setting and
	releasing item in mid-session. Fixes bugs #81440, #81140 and
	#80723


svn path=/trunk/mcs/; revision=76490
2007-04-30 13:36:38 +00:00
Marek Habersack ef5770b5a3 2007-04-18 Marek Habersack <[email protected]>
* SessionInProcHandler.cs: added protection against raising early
	session end event when resetting item timeout. Fixes bug #81140

svn path=/trunk/mcs/; revision=75863
2007-04-18 09:31:03 +00:00
Konstantin Triger 675fb4eaa5 suppress errors for unsupported session mode and fallback to the servlet session provider
svn path=/trunk/mcs/; revision=75254
2007-04-01 09:33:02 +00:00