forked from umbraco/Umbraco-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V10: Build warnings in Web.Website (umbraco#12332)
* add new rule to globalconfig * Fix warnings in Web.Website * Fix more warnings in Web.Website * Fix more build warnings in Web.Website * Fix more warnings in Web.Website * Fix tests * Fix proper constructor call * Fix not being able to run project * Fix Obsolete method Co-authored-by: Nikolaj Geisle <[email protected]>
- Loading branch information
Showing
47 changed files
with
3,304 additions
and
3,226 deletions.
There are no files selected for viewing
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
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
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
51 changes: 24 additions & 27 deletions
51
src/Umbraco.Web.Website/ActionResults/RedirectToUmbracoUrlResult.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.ViewFeatures; | ||
using Umbraco.Cms.Core.Web; | ||
|
||
namespace Umbraco.Cms.Web.Website.ActionResults | ||
namespace Umbraco.Cms.Web.Website.ActionResults; | ||
|
||
/// <summary> | ||
/// Redirects to the current URL rendering an Umbraco page including it's query strings | ||
/// </summary> | ||
/// <remarks> | ||
/// This is useful if you need to redirect | ||
/// to the current page but the current page is actually a rewritten URL normally done with something like | ||
/// Server.Transfer. It is also handy if you want to persist the query strings. | ||
/// </remarks> | ||
public class RedirectToUmbracoUrlResult : IKeepTempDataResult | ||
{ | ||
private readonly IUmbracoContext _umbracoContext; | ||
|
||
/// <summary> | ||
/// Redirects to the current URL rendering an Umbraco page including it's query strings | ||
/// Initializes a new instance of the <see cref="RedirectToUmbracoUrlResult" /> class. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is useful if you need to redirect | ||
/// to the current page but the current page is actually a rewritten URL normally done with something like | ||
/// Server.Transfer. It is also handy if you want to persist the query strings. | ||
/// </remarks> | ||
public class RedirectToUmbracoUrlResult : IActionResult, IKeepTempDataResult | ||
{ | ||
private readonly IUmbracoContext _umbracoContext; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="RedirectToUmbracoUrlResult"/> class. | ||
/// </summary> | ||
public RedirectToUmbracoUrlResult(IUmbracoContext umbracoContext) => _umbracoContext = umbracoContext; | ||
public RedirectToUmbracoUrlResult(IUmbracoContext umbracoContext) => _umbracoContext = umbracoContext; | ||
|
||
/// <inheritdoc/> | ||
public Task ExecuteResultAsync(ActionContext context) | ||
/// <inheritdoc /> | ||
public Task ExecuteResultAsync(ActionContext context) | ||
{ | ||
if (context is null) | ||
{ | ||
if (context is null) | ||
{ | ||
throw new ArgumentNullException(nameof(context)); | ||
} | ||
throw new ArgumentNullException(nameof(context)); | ||
} | ||
|
||
var destinationUrl = _umbracoContext.OriginalRequestUrl.PathAndQuery; | ||
var destinationUrl = _umbracoContext.OriginalRequestUrl.PathAndQuery; | ||
|
||
context.HttpContext.Response.Redirect(destinationUrl); | ||
context.HttpContext.Response.Redirect(destinationUrl); | ||
|
||
return Task.CompletedTask; | ||
} | ||
return Task.CompletedTask; | ||
} | ||
} |
Oops, something went wrong.