1
/* ****************************************************************************
3 * Copyright (c) Microsoft Corporation. All rights reserved.
5 * This software is subject to the Microsoft Public License (Ms-PL).
6 * A copy of the license can be found in the license.htm file included
7 * in this distribution.
9 * You must not remove this notice, or any other, from this software.
11 * ***************************************************************************/
13 namespace System
.Web
.Mvc
{
15 using System
.Diagnostics
.CodeAnalysis
;
16 using System
.Web
.Mvc
.Resources
;
18 // represents a result that performs a redirection given some URI
19 public class RedirectResult
: ActionResult
{
21 [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId
= "0#",
22 Justification
= "Response.Redirect() takes its URI as a string parameter.")]
23 public RedirectResult(string url
) {
24 if (String
.IsNullOrEmpty(url
)) {
25 throw new ArgumentException(MvcResources
.Common_NullOrEmpty
, "url");
31 [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings",
32 Justification
= "Response.Redirect() takes its URI as a string parameter.")]
38 public override void ExecuteResult(ControllerContext context
) {
39 if (context
== null) {
40 throw new ArgumentNullException("context");
43 string destinationUrl
= UrlHelper
.Content(Url
, context
.HttpContext
);
44 context
.HttpContext
.Response
.Redirect(destinationUrl
, false /* endResponse */);