Commit Graph
308 Commits
Author SHA1 Message Date
Etienne CHAMPETIER 9b7b75d7ec WebConfigurationManager: simplify call to ConfigurationSection.GetRuntimeObject ()
this call come from an obfuscation contest :) ?

Signed-off-by: Etienne CHAMPETIER <[email protected]>
2014-10-24 16:17:01 +02:00
Etienne CHAMPETIER 3fd3541704 WebConfigurationManager: protect GetSection
all public static should be thread-safe

Signed-off-by: Etienne CHAMPETIER <[email protected]>
2014-10-24 16:16:55 +02:00
Alexander Köplinger 48e112d652 [Cleanup] Removed TARGET_JVM
It was once part of a special Java target profile, but this is no longer used today.
2014-08-08 03:28:34 +02:00
Alexander Köplinger a8b2f07578 [Cleanup] Removed .jvm.cs files that are no longer used
They were once part of a special Java target profile, but this is no longer used today.
2014-08-07 23:01:51 +02:00
Marek Habersack 92f2a76fea [system.web] remove some more remnants of Mono.Web.dll to fix Xamarin Studio activation
The section mapping system wasn't being initialized and used properly since some ifdefs had
been left in the source code. This caused a null reference exception while trying to perform
some HTTP requests and, as the result, broke Xamarin Studio activation.
2014-05-12 19:33:10 +02:00
Frederic Mestayer 03e31732d3 [System.Web] Do not crash on duplicate keys in browser capabilities
Correct https://bugzilla.xamarin.com/show_bug.cgi?id=14720 and
probably https://bugzilla.xamarin.com/show_bug.cgi?id=13014

Signed-off-by: Etienne CHAMPETIER <[email protected]>
Signed-off-by: Frederic Mestayer <[email protected]>
2013-09-20 14:19:40 +02:00
Alexander Köplinger 9ccd495f33 Added handling of 'targetFramework' attribute (new in .NET 4.5) to HttpRuntime and HttpRuntimeSection 2013-07-06 16:53:22 +02:00
Andres G. Aragoneses 7fe883d9c5 [System.Web] Improve locking logic for WebConfigManager's sectionCache
As suggested by Marek Habersack, instead of catching
SynchronizationLockException in the case that the lock wasn't
acquired, we now have a boolean that indicates if it was
acquired or not, so we can act on it on the finally{} block.
2013-05-27 21:27:33 +01:00
Andres G. Aragoneses 7d75358e6c [WebConfigurationManager] Fix memleak by using a LruCache (BXC#5598)
System.Web.ConfigurationManager had a cache which didn't have any max limit,
therefore when using Restful URIs in ASP.NET (like having some variable
parameter in the virtual path, i.e. /user/{userId}/tracks, where {userId}
is a variable Integer) this was very likely to cause a leak which would
end up causing troubles, like an InvalidCastException thrown by
HttpApplication::PreStart()

(Read operations in the cache now cause a write operation on the cache
object, so all sectionCache lock-read usages are converted to lock-write.)

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=5598
2013-05-14 17:47:40 +01:00
Bojan Rajkovic db8f33718a Revert "Merge pull request #618 from knocte/aspnet_lru"
This reverts commit 675328ef16, reversing
changes made to edc181c514.
2013-05-01 17:05:12 -04:00
Andres G. Aragoneses 126d079b84 [System.Web] Use STDERR instead of STDOUT in LRUcache
As suggested by Marek Habersack
2013-04-26 17:03:54 +01:00
Andres G. Aragoneses e072c0ec34 [System.Web] Move MONO_ASPNET_WEBCONFIG_CACHESIZE parsing out of LRUcache 2013-04-26 16:58:50 +01:00
Andres G. Aragoneses d198187591 [WebConfigurationManager] Reset LRUcache eviction count in Clear() 2013-04-25 00:10:50 +01:00
Andres G. Aragoneses d94839c493 [WebConfigurationManager] Make the max LRUcache size configurable
Using the env var MONO_ASPNET_WEBCONFIG_CACHESIZE, as discussed in BXC#5598
2013-04-25 00:01:08 +01:00
Andres G. Aragoneses 4f9bdfab16 [System.Web] Coding style nits in LruCache 2013-04-24 12:35:26 +01:00
Andres G. Aragoneses 96bbdc60bf [WebConfigurationManager] Fix memleak by using a LruCache (BXC#5598)
System.Web.ConfigurationManager had a cache which didn't have any max limit,
therefore when using Restful URIs in ASP.NET (like having some variable
parameter in the virtual path, i.e. /user/{userId}/tracks, where {userId}
is a variable Integer) this was very likely to cause a leak which would
end up causing troubles, like an InvalidCastException thrown by
HttpApplication::PreStart()

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=5598
2013-04-23 16:36:42 +01:00
aerisg222 c2fc2dc584 initial implementation of http capability provider introduced in .net 4.0. 2012-08-02 12:49:26 -04:00
Pablo Ruiz Garcia 05325691a2 Fix browser capabilities compatibility with ms.net by 1) Avoid issues with capabilities defined with same name, but diferent case. and 2) favor majorversion/minorversion capabilities, but fallback to majorver/minorver if not found, to preserve compatibility with previous versions. 2012-04-05 20:22:19 +02:00
Martin 231819c3b2 Completes commit https://github.com/QuickJack/mono/commit/1daeb920c64e47b4671e6ce4ea8c83158e6e7e6e 2012-02-14 16:46:13 +01:00
Martin 1daeb920c6 Implements Grendello's suggestions to WebConfigurationManager class 2012-02-14 16:42:50 +01:00
Martin 821a558b5d Fixes a bug in WebConfigurationManager
Following is a step by step guide to create a testing project:

(1) Create an ASP.NET project in MonoDevelop
(2) Create a folder "base"
(3) Create two subfolders called "sub1" and "sub2" inside of "base"
(4) Create a web.config file in both sub folders "sub1" and "sub2" and enter the following code:

<configuration>
  	<appSettings>
		<add key="myText" value="src=sub1"/>
	</appSettings>
</configuration>

Set the "value=" element to the appropriate value of the corresponding sub folder.

(5) Enter the following code in Default.aspx.cs
public void Page_Load(object sender, EventArgs args)
{
	//c2.ConfigPath contains wrong path
	Configuration c1 = WebConfigurationManager.OpenWebConfiguration("~/base/sub1");
	Configuration c2 = WebConfigurationManager.OpenWebConfiguration("~/base/sub2");
			
	//myText_sub2 refers to the wrong AppSettings entry
	KeyValueConfigurationElement myText_sub1 = (KeyValueConfigurationElement)c1.AppSettings.Settings["myText"];
	KeyValueConfigurationElement myText_sub2 = (KeyValueConfigurationElement)c2.AppSettings.Settings["myText"];
}
2012-01-18 10:50:23 +01:00
QuickJack cd2c570c55 Allows write access to web.config files below an app's root. 2012-01-10 21:01:16 +01:00
Martin 3a604b81c5 http://bugzilla.xamarin.com/show_bug.cgi?id=2345 2011-12-12 13:12:07 +01:00
Marek Habersack 7662f68051 [asp.net] Shorten code in WebConfigurationHost 2011-04-14 20:49:30 +02:00
Marek Habersack c04e994ef6 [asp.net] A more effective way of looking for web.config 2011-04-13 16:56:37 +02:00
Martin f56770d667 [asp.net] Fix for bug #658184. AuthorizationRule restores its Action when unmerging. 2011-03-30 12:20:33 +02:00
Marek Habersack 1171cacd8d [asp.net] Implemented CustomErrorsRedirectMode 2011-02-09 01:24:16 +01:00
Marek Habersack 886240dea0 [asp.net] HttpRuntimeSection.RequestPathInvalidCharacters default value is different 2011-02-03 17:34:28 +01:00
Marek Habersack df3af8d7ec [asp.net,mcs] Fixed 'protected internal' build errors and removed System.Web-specific hack from mcs 2011-01-10 11:16:44 +01:00
Gonzalo Paniagua Javier 93483a4b8f Don't throw when unable to write autogen keys
It is possible that the user running the ASP.NET application does not
	have permission to write to the registry. In this case, the auto
	generated keys will be created on every application start.
2010-11-18 17:39:01 -05:00
Marek Habersack 06cdf56198 [asp.net] 4.0-only types don't need the NET_4_0 ifdef and should be in net_4_0_System.Web.dll.sources 2010-11-02 11:30:26 +01:00
Marek Habersack 7244e38c9f [asp.net] HttpRuntime.AppDomainAppPath may be null during tests, check it before using. 2010-10-26 02:00:21 +02:00
Marek Habersack 4662d97427 [asp.net] Better handling of application's AppDomain restart
* HttpRuntime.cs: disable filesystem watchers on appdomain shutdown and refuse to process
  requests while the current AppDomain is unloading
* HttpApplicationFactory.cs: if the current AppDomain is unloading, ignore FileSystemWatcher
  notifications
* WebConfigurationManager.cs: work around a deadlock issue when entering a ReaderWriterLockSlim
  upgradeable read lock very early during ASP.NET runtime/AppDomain initialization. Every few runs
  the attempt would lock up and since adding a section to cache is not a critical operation we can
  afford timing the lock out in this case. The lockup is probably due to the fact that RWLS is using
  thread local storage to store the current thread's lock status and it may happen that the TLS is
  not cleared during thread object finalization (see metadata/threads.c, the start_wrapper function)
2010-10-25 13:25:39 +02: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
Marek Habersack cba40249f9 [asp.net] Part of fix for bug #579837. AuthorizationRule.SerializeElement will not process unmodified elements.
* AuthorizationRule.cs: if the configuration save is not Full, SerializeElement checks whether the rule being
  serialized is modified. If it isn't, validation and serialization are not performed.
* AuthorizationRuleCollection.cs: there is no element name for the collection.
2010-10-04 15:43:54 +02:00
Marek Habersack ae23776616 [asp.net] Get rid of a possible (although unlikely) race condition when acquiring locks
The patch removes a small race condition where a boolean flag is set after acquiring a lock to
indicate to code executing in the finally {} block that it should release the lock. The boolean
variable is now removed and the lock is released unconditionally. It carries a potential to
throw an exception when the lock is not held, but it's better than to fail to release it and
lead the application to a deadlock.
2010-09-28 13:29:21 +02:00
Marek Habersack 4f20ce19f2 [asp.net] Partial fix for bug #575600. Support opening another app configuration.
WebConfigurationHost now supports one more parameter passed to it in InitForConfiguration -
a boolean telling whether the configuration being initialized belongs to another app. If it is
true then the virtual path passed to InitForConfiguration is used as the application virtual
path. This has the effect that IsDefinitionAllowed doesn't throw an exception when a configuration
element with the MachineToApplication level is parsed.
WebConfigurationManager.FindWebConfig checks whether the path passed to it belongs to this application
which allows the mechanism described in the first paragraph to work.
2010-08-11 22:23:49 +02:00
Jb Evain b87bd5ff29 [Perf] avoid an exception when reading a non existent app configuration
Make implementors of IInternalConfigurationHost.OpenStreamForRead return null instead of throwing an exception when there's no usable configuration file and deal with null at the call site.
2010-08-06 17:27:40 +02:00
Marek Habersack b0f59ebc86 [asp.net] implemented BaseTemplateParser.{GetReferencedType,GetUserControlType} methods
* BuildProvider.cs: factored out build provider type retrieval code to a separate method
* BuildProviderCollection.cs: factored out build provider type retrieval code to a separate method
* BuildManagerDirectoryBuilder.cs: system.web/compilation section is not an application section - it can
  be defined in web.config on any level.
2010-08-04 21:50:33 +02:00
Marek Habersack d8838a6414 This commit introduces a few 4.0 rendering changes which break some tests. The broken tests
fail to work on .NET 4.0 as well, for the most part. I will fix them next week.

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

    	* TemplateControlParser.cs: added support for ClientIDMode
    	property

    	* Control.cs: implemented 4.0 features - ClientIDMode and
    	RenderingCompatibility.

    	* ClientIDMode.cs, IDataKeysControl.cs: added

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

    	* Menu.cs: 4.0 API updates.

    	* GridView.cs: implemented 4.0 properties -
    	SortedAscendingCellStyle, SortedAscendingHeaderStyle,
    	SortedDescendingCellStyle, SortedDescendingHeaderStyle,
    	ClientIDRowSuffix, ClientIDRowSuffixDataKeys, ShowHeaderWhenEmpty
    	along with associated rendering changes.

    	* DetailsView.cs, FormView.cs, GridView.cs: 4.0 API changes -
    	renamed ShowPage to SetPageIndex and made it public.
    	Added 4.0 interfaces to inheritance list and implemented them.

    	* DataKeyArray.cs: added internal constructor which accepts IList
    	instead of ArrayList. Changed the 'keys' field type to IList.

    	* ContainedTable.cs: the 'id' attribute must be rendered last.

    	* CheckBox.cs, CheckBoxList.cs, SiteMapPath.cs, Table.cs,
    	TableStyle.cs, TextBox.cs, WebControl.cs: 4.0 rendering changes.

    	* Calendar.cs, CompositeControl.cs, DropDownList.cs, HyperLink.cs,
    	Image.cs, ImageButton.cs, Label.cs, LinkButton.cs, LoginName.cs,
    	Panel.cs, Table.cs, TableCell.cs, TableRow.cs:
    	added new 4.0 property, SupportsDisabledAttribute.

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

    	* VersionConverter.cs: added support for checking whether the
    	passed version is equal or more than a specified minimal version.

    	* PagesSection.cs: added two 4.0 properties - ClientIDMode and
    	ControlRenderingCompatibilityVersion

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

    	* TemplateControlCompiler.cs: added support for ClientIDMode 4.0
    	property

    	* PageCompiler.cs, UserControlCompiler.cs: AddStatementsToInitTop
    	must call the base implementation.

svn path=/trunk/mcs/; revision=159826
2010-07-02 19:12:31 +00:00
Marek Habersack 15e158a0e1 - updated obsolete types/members
- added missing type/member attributes
- use generic types in Page wherever possible

svn path=/trunk/mcs/; revision=158360
2010-06-02 19:04:08 +00:00
Marek Habersack f8d637595c 2010-06-01 Marek Habersack <[email protected]>
* HttpUtility.cs: moved chunks of code to the new
	System.Web.Util.HttpEncoder class.

	* HttpResponseHeader.cs: encode header names and values using
	HttpEncoder.

	* HttpRequest.cs: added internal method Validate, to validate the
	request in 4.0 profile.

	* HttpHeaderCollection.cs: added. A helper class to encode header
	names/values on add.

	* HttpApplication.cs: Pipeline () validates request by calling
	HttpRequest.Validate in the 4.0 profile.

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

	* HttpEncoder.cs: added. A 4.0 type but also used in 2.0 profile,
	internally.

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

	* HttpRuntimeSection.cs: added 4.0 properties
	MaxQueryLengthString, MaxUrlLength, EncoderType and
	RelaxedUrlToFileSystemMapping.

svn path=/trunk/mcs/; revision=158300
2010-06-01 19:39:19 +00:00
Marek Habersack d410d4fe4a 2010-05-17 Marek Habersack <[email protected]>
* HttpApplicationFactory.cs: pre-application start methods must be
	called even before App_Code is compiled.

2010-05-17  Marek Habersack  <[email protected]>

	* BuildProvider.cs: made the Extension property case-insensitive

2010-05-17  Marek Habersack  <[email protected]>

	* BuildProvider.cs: implemented a 4.0 method RegisterBuildProvider

	* BuildManager.cs: separated dynamically registered assemblies
	store from the referenced assemblies cache.

svn path=/trunk/mcs/; revision=157435
2010-05-17 10:58:08 +00:00
Marek Habersack 61163ca5e2 2010-04-09 Marek Habersack <[email protected]>
* WebConfigurationManager.cs: GetSection properly processes paths
	of form '~'. Fixes bug #595140. Patch from Adriaan van Kekem
	<[email protected]>, thanks!

svn path=/trunk/mcs/; revision=155140
2010-04-09 13:01:51 +00:00
Gonzalo Paniagua Javier a96be27a9e CWL
svn path=/trunk/mcs/; revision=155083
2010-04-08 19:15:05 +00:00
Gonzalo Paniagua Javier c95949df0a 2010-04-08 Gonzalo Paniagua Javier <[email protected]>
* GlobalizationSection.cs: use WebName instead of EncodingName.


svn path=/trunk/mcs/; revision=155080
2010-04-08 19:11:23 +00:00
Marek Habersack c6c642eec3 commit 9405fa168b1255c51bb31ef17511c05593b08caa
Author: Marek Habersack <[email protected]>
Date:   Sat Mar 6 03:37:53 2010 +0100

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

    	* CompilerCollection.cs: in the 4.0 profile, the latest C#
    	standard is the compiler's default.

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

    	* CSharpCodeCompiler.cs: in the 4.0 profile, the latest C#
    	standard is the default one.

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

    	* RequestValidatorTestGenerated.cs: added

    	* RequestValidator.cs: added

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

    	* TestWorkerRequest.cs: added overloads of GetRawUrl and
    	GetUriPath which make sure that the returned paths do not contain
    	more than one leading / character.

    	* TestRunItem.cs: added new TestRunData property - to contain
    	per-appdomain test run data.

    	* TestCallback.cs: added a TestRunItem parameter.

    	* StandaloneTest.cs: runner object is created for each test item
    	now.
    	Added test progress feedback.

    	* ITestRunner.cs: added two properties, TestRunData - to return
    	collected test result data, if any, and Domain which returns the
    	current AppDomain.

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

    	* RequestValidatorTest.cs: added

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

    	* HttpRequest.cs: cache RawUrl value.
    	Added new internal property, PathNoValidation, which returns
    	request path without validating it.
    	Implemented 4.0 extensible validation.

    	* HttpApplication.cs: Pipeline () validates the request path, if
    	new validation mode is enabled, before doing anything else.
    	Added a generic LoadType overload which checks whether the loaded
    	type, if any, derives from the type specified in the method's
    	specialization.

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

    	* RequestValidator.cs: added

    	* RequestValidationSource.cs: added

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

    	* WebConfigurationManager.cs: do not use Request.Path - it may
    	fail because of invalid web.config file, use
    	Request.PathNoValidation instead.

    	* VersionConverter.cs: added

    	* PropertyHelper.cs: added a Version converter helper.

    	* HttpRuntimeSection.cs: added 4.0 properties -
    	RequestPathInvalidCharacters, RequestValidationType and
    	RequestValidationMode.

svn path=/trunk/mcs/; revision=153172
2010-03-06 02:48:31 +00: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 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