This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Foundation.SitecoreExtensions.Services | |
{ | |
using Sitecore.Diagnostics; | |
using Sitecore.Foundation.DependencyInjection; | |
using Sitecore.XConnect; | |
using Sitecore.XConnect.Client; | |
using System; | |
using System.Linq; | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<!-- :: Only applicable to CA environments :: --> | |
<!-- this skips placeholder (Header and Footer) in EE but can be toggled back on with a button in the EE ribbon --> | |
<sitecore> | |
<pipelines> | |
<mvc.renderPlaceholder> | |
<!-- Patch to be first processor --> | |
<processor type="Community.Foundation.Optimizations.Pipelines.MvcRenderPlaceholder.SkipPlaceholdersByUserSetting, Community.Foundation.Optimizations" | |
patch:before="*[1]"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Community.Foundation.Mvc | |
{ | |
using System.Reflection; | |
using System.Web.Mvc; | |
/// <summary> | |
/// Mechanism to handle multiple sitecore form renderings on a page | |
/// When one is posted, all receive the post verb | |
/// Mark all with this attribute and it will revert to the Get method when its form is not the real one being called. | |
/// Example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Community.Foundation.Mvc | |
@model ExampleModel | |
<div class="component"> | |
<p>Form B</p> | |
<form method="post"> | |
@Html.MultiformPostProtection() <!-- Becomes: <input type="hidden" name="__FormToken" value="FormB" /> --> | |
@Html.AntiForgeryToken() | |
<input type="submit"/> | |
</form> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Community.Foundation.Mvc | |
@model ExampleModel | |
<div class="component"> | |
<p>Form A</p> | |
<form method="post"> | |
@Html.MultiformPostProtection()<!-- Becomes: <input type="hidden" name="__FormToken" value="FormA" /> --> | |
@Html.AntiForgeryToken() | |
<input type="submit"/> | |
</form> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
public ActionResult FormA() | |
{ | |
var model = _example.GetModel(); | |
return PartialView(model); | |
} | |
[HttpPost] | |
[MultiformPostProtection] /* Verifies form token matches this action, Form A, otherwise returns FormA() */ | |
[ValidateAntiForgeryToken] | |
public ActionResult FormA(ExampleModel model) |