Commit Graph

42 Commits

Author SHA1 Message Date
Doug Bunting c74a945dda
Convert `RouteValueDictionary` values to `string` using `CultureInfo.InvariantCulture` (#8674)
* Convert `RouteValueDictionary` values to `string` using `CultureInfo.InvariantCulture`
- #8578
- user may override this choice in one case:
  - register a custom `IValueProviderFactory` to pass another `CultureInfo` into the `RouteValueProvider`
- values are used as programmatic tokens outside `RouteValueProvider`

nits:
- take VS suggestions in changed classes
- take VS suggestions in files I had open :)
2018-10-30 20:09:17 -07:00
Simon Cropp b156dee4f1 Fix some spelling (#8378) 2018-09-06 07:39:01 -07:00
Artak Mkrtchyan 6d9aa281c5
Render `maxlength` attribute for an input tag, when MaxLength or StringLength validation attributes are applied to the model class. 2018-08-02 13:44:19 -07:00
Pranav K 8e31319215
Prevent null refs in some simple cases in CachedExpressionCompiler
Fixes #6928
2018-05-29 11:09:48 -07:00
Pranav K e1eaf6a6e0
Cleanup TestCommon 2018-05-18 10:45:57 -07:00
Pranav K b196708a3e Merge tag '2.0.2' into dev 2018-01-10 10:02:54 -08:00
Doug Bunting ecedbd5372 Allow `null` or empty `fullName` in one special case
- #6662
- users can now provide a `name` or `data-valmsg-for` attribute to avoid `ArgumentException`s
  - affects `<input>`, `<select>`, `<textarea>` elements and validation message `<div>`s
- remove `fullName` check in `DefaultHtmlGenerator.GetCurrentValues(...)` entirely

The new workaround is _not_ identical to changing `ViewData.TemplateInfo.HtmlFieldPrefix`
- does not change where expression values are found in `ModelState` or `ViewData`
- likely needs to be combined with additional workarounds i.e. for advanced use only

nits:
- clean up some excessive argument naming; add a few missing argument names
- take VS suggestions in changed classes e.g. inline a few variable declarations
- clean up some test data
2018-01-09 08:53:37 -08:00
N. Taylor Mullen 7cea779b7a Update JsonHelper to escape HTML.
- This functionality can be disabled by setting the `Switch.Microsoft.AspNetCore.Mvc.AllowJsonHtml` switch in an app.config.
- Updated tests to react to this new behavior.
- Exposed a new `PublicSerializerSettings` property on `JsonOutputFormatter` so we can accurately copy settings from the used output formatter in `JsonHelper`.
2017-12-07 16:12:43 -08:00
Pranav K 41efa409a4 Remove TestOptionsManager 2017-10-30 17:49:15 -07:00
Nate McMaster 3f02482617 Minor test code changes to resolve xUnit2013 build error 2017-10-05 16:04:20 -07:00
Ryan Nowak 38712609bb Design extensibility for executors
We have all of these executors but they aren't really
documented/supported for extensibility today. This change introduces a
pattern for action result executors so we can make them extensible.
2017-09-22 10:32:55 -07:00
Kiran Challa b2f9ad1b67 Changed CookieTempDataProvider's CookieSecurePolicy from SameAsRequest to None 2017-08-29 14:55:52 -07:00
Kiran Challa cfc05104e4 Updated to use WebEncoders utility's Base64Url encode/decode functionality 2017-08-29 08:37:28 -07:00
Nate McMaster 3a710c3d64 Upgrade to xunit 2.3.0-beta4 2017-08-17 10:45:03 -07:00
Ryan Nowak f80f7cefa5 Fix #6480
This change logs when we encounter and exception reading temp data from a
cookie and swallows the exception. Additionally, we clear the cookie so
that this won't happen on subsequent requests.

This will handle cases where data protection is misconfigured, or a
request just has general garbage in the cookies.
2017-07-07 13:14:03 -07:00
Chris R b9541be20d React to ISession cancellation changes 2017-07-05 14:34:48 -07:00
Nate McMaster 1eb7f9e032 Add CookieBuilder to CookieTempDataProviderOptions and obsolete duplicate API (#6472) 2017-07-05 10:19:13 -07:00
Nate McMaster 12ea28af5c React to API change in HttpAbstractions 2017-06-27 17:33:46 -07:00
Doug Bunting cacee2a837 Break fix: Undo part of 141b637
- affected test using a test factory for `HttpResponseStreamWriter`s
2017-04-23 21:48:42 -07:00
Doug Bunting 141b637d20 Bump `MemoryPoolHttpResponseStreamWriter` buffer size up to 16K `char`s
- #3516
- fix tests that relied on otherwise-unused `HttpResponseStreamWriter.DefaultBufferSize`
2017-04-23 16:15:58 -07:00
Kiran Challa 17dc23a024 [Fixes #5637] Make CookieName of CookieTempDataProvider configurable 2017-01-27 11:01:26 -08:00
Jass Bagga 9b1271ba19 Remove obsolete DefaultHtmlGenerator ctor (#5711) 2017-01-25 16:25:12 -08:00
Kiran Challa 07a2f1de06 Fixes CookieTempDataProvider to set the secure attribute of a cookie only if a request is secure 2016-11-08 13:30:28 -08:00
Kiran Challa a3c06b00cc Fixes CookieTempDataProvider to handle empty request PathBase while setting cookie options 2016-11-08 13:30:27 -08:00
Kiran Challa 32710bbfbe [#5430] CookieTempDataProvider chunking broken 2016-11-01 16:13:27 -07:00
Kiran Challa 89bd6dc1cd [Fixes #5212] Added a cookie based ITempDataProvider 2016-10-03 14:04:57 -07:00
Ajay Bhargav Baaskaran 42027b6cc2 [Fixes #5243] Handle null values in TempData properly 2016-09-14 15:41:38 -07:00
Doug Bunting 809d2bf7ec Add `ValidationHtmlAttributeProvider` to make `AddValidationAttributes()` available
- #5028
- helpers similar to our HTML or tag helpers can use the new singleton to examine or add validation attributes
 - in the most common case, helpers add validation attributes to a `TagBuilder`
- separate `DefaultValidationHtmlAttributeProvider` from `DefaultHtmlGenerator`
 - avoids creating two instances of the `DefaultHtmlGenerator` singleton
 - would be even uglier to require callers to cast an `IHtmlGenerator` to `ValidationHtmlAttributeProvider`
- `[Obsolete]` old `DefaultHtmlGenerator` constructor
2016-09-13 21:07:18 -07:00
Doug Bunting 8a6e99c7c0 Always render antiforgery tokens if `!CanRenderAtEndOfForm`
- #5005
- also add `FormContext` doc comments
2016-07-20 15:25:08 -07:00
Ryan Brandenburg 310ab25347 Make tests resilient to Localization (#5011) 2016-07-14 09:28:01 -07:00
jacalvar 4b5df98bc3 [Fixes #4224] Remove use of service locator on ViewExecutor 2016-05-31 23:39:22 -07:00
John Luo ff534da70f React to adding IsAvailable to ISession 2016-05-23 15:17:30 -07:00
Kiran Challa 93be3dee6e Fix FormTagHelper to set flag indicating generation of AntiforgeryToken
[Fixes #4595] Better error message with extraneous @Html.AntiforgeryToken
2016-05-20 04:29:01 -07:00
Doug Bunting a0c8834c70 Preserve existing metadata in `ViewDataDictionary` where possible
- #4116
- generalize rules for `ModelMetadata` creation; minimize metadata changes when Model is updated
 - down to a single special case in VDD for `Nullable<T>`
 - note existing functional tests did not need to change
- remove `ViewDataDictionary(ViewDataDictionary, object)` constructor; use `new VDD<object>(source, model)`
- allow all `Model` assignments in a view component
 - copy-constructed VDD in `ViewComponentContext` previously preserved the source's declared type

nits:
- do not call `virtual SetModel()` method from constructor; now mostly redundant
 - logic in copy constructor and `SetModel()` is consistent but different enough to keep code separate
- add some missing doc comments
- fix doc comment property versus type confusion; never need to specify `ViewDataDictionary.` prefix
- fix a few `TemplateBuilder` comments and remove unnecessary `model: null` argument to VDD constructor
2016-04-08 14:44:36 -07:00
Doug Bunting 6bf25cecec React to HttpAbstractions namespace changes
- aspnet/HttpAbstractions#549 and aspnet/HttpAbstractions#592
- clean up `using`s
2016-03-30 16:19:42 -07:00
Ajay Bhargav Baaskaran e39cbf077c React to aspnet/Session#96 changes 2016-03-04 17:18:34 -08:00
Ryan Nowak 9ea5a939cf Move Antiforgery.GetHtml() to MVC as an extension 2016-02-04 13:08:38 -08:00
Ajay Bhargav Baaskaran 47351aac7a Added caching for client model validators 2016-01-29 10:40:41 -08:00
ryanbrandenburg 78e7179221 * Remove HttpRespomseStreamWriter 2016-01-27 16:04:54 -08:00
Ryan Nowak 8b1bd343ba Internal cleanup in ViewFeatures 2016-01-24 22:13:29 -08:00
N. Taylor Mullen 3be7fbdf9f Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:18:33 -08:00
N. Taylor Mullen 6a6c8ca544 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:17:07 -08:00