uncomment old file
This commit is contained in:
@@ -261,52 +261,52 @@ namespace Umbraco.Web
|
||||
//
|
||||
// #endregion
|
||||
|
||||
/// <summary>
|
||||
/// Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="controllerName"></param>
|
||||
/// <returns></returns>
|
||||
public static string SurfaceAction(this UrlHelper url, string action, string controllerName)
|
||||
{
|
||||
return url.SurfaceAction(action, controllerName, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="controllerName"></param>
|
||||
/// <param name="additionalRouteVals"></param>
|
||||
/// <returns></returns>
|
||||
public static string SurfaceAction(this UrlHelper url, string action, string controllerName, object additionalRouteVals)
|
||||
{
|
||||
return url.SurfaceAction(action, controllerName, "", additionalRouteVals);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="controllerName"></param>
|
||||
/// <param name="area"></param>
|
||||
/// <param name="additionalRouteVals"></param>
|
||||
/// <returns></returns>
|
||||
public static string SurfaceAction(this UrlHelper url, string action, string controllerName, string area, object additionalRouteVals)
|
||||
{
|
||||
if (action == null) throw new ArgumentNullException(nameof(action));
|
||||
if (string.IsNullOrEmpty(action)) throw new ArgumentException("Value can't be empty.", nameof(action));
|
||||
if (controllerName == null) throw new ArgumentNullException(nameof(controllerName));
|
||||
if (string.IsNullOrEmpty(controllerName)) throw new ArgumentException("Value can't be empty.", nameof(controllerName));
|
||||
|
||||
var encryptedRoute = CreateEncryptedRouteString(controllerName, action, area, additionalRouteVals);
|
||||
|
||||
var result = Current.UmbracoContext.OriginalRequestUrl.AbsolutePath.EnsureEndsWith('?') + "ufprt=" + encryptedRoute;
|
||||
return result;
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
|
||||
// /// </summary>
|
||||
// /// <param name="url"></param>
|
||||
// /// <param name="action"></param>
|
||||
// /// <param name="controllerName"></param>
|
||||
// /// <returns></returns>
|
||||
// public static string SurfaceAction(this UrlHelper url, string action, string controllerName)
|
||||
// {
|
||||
// return url.SurfaceAction(action, controllerName, null);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
|
||||
// /// </summary>
|
||||
// /// <param name="url"></param>
|
||||
// /// <param name="action"></param>
|
||||
// /// <param name="controllerName"></param>
|
||||
// /// <param name="additionalRouteVals"></param>
|
||||
// /// <returns></returns>
|
||||
// public static string SurfaceAction(this UrlHelper url, string action, string controllerName, object additionalRouteVals)
|
||||
// {
|
||||
// return url.SurfaceAction(action, controllerName, "", additionalRouteVals);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Generates a URL based on the current Umbraco URL with a custom query string that will route to the specified SurfaceController
|
||||
// /// </summary>
|
||||
// /// <param name="url"></param>
|
||||
// /// <param name="action"></param>
|
||||
// /// <param name="controllerName"></param>
|
||||
// /// <param name="area"></param>
|
||||
// /// <param name="additionalRouteVals"></param>
|
||||
// /// <returns></returns>
|
||||
// public static string SurfaceAction(this UrlHelper url, string action, string controllerName, string area, object additionalRouteVals)
|
||||
// {
|
||||
// if (action == null) throw new ArgumentNullException(nameof(action));
|
||||
// if (string.IsNullOrEmpty(action)) throw new ArgumentException("Value can't be empty.", nameof(action));
|
||||
// if (controllerName == null) throw new ArgumentNullException(nameof(controllerName));
|
||||
// if (string.IsNullOrEmpty(controllerName)) throw new ArgumentException("Value can't be empty.", nameof(controllerName));
|
||||
//
|
||||
// var encryptedRoute = CreateEncryptedRouteString(controllerName, action, area, additionalRouteVals);
|
||||
//
|
||||
// var result = Current.UmbracoContext.OriginalRequestUrl.AbsolutePath.EnsureEndsWith('?') + "ufprt=" + encryptedRoute;
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//TODO Move to LinkGenerator
|
||||
// /// <summary>
|
||||
@@ -384,42 +384,42 @@ namespace Umbraco.Web
|
||||
// return url.SurfaceAction(action, typeof (T), additionalRouteVals);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// This is used in methods like BeginUmbracoForm and SurfaceAction to generate an encrypted string which gets submitted in a request for which
|
||||
/// Umbraco can decrypt during the routing process in order to delegate the request to a specific MVC Controller.
|
||||
/// </summary>
|
||||
/// <param name="controllerName"></param>
|
||||
/// <param name="controllerAction"></param>
|
||||
/// <param name="area"></param>
|
||||
/// <param name="additionalRouteVals"></param>
|
||||
/// <returns></returns>
|
||||
internal static string CreateEncryptedRouteString(string controllerName, string controllerAction, string area, object additionalRouteVals = null)
|
||||
{
|
||||
if (controllerName == null) throw new ArgumentNullException(nameof(controllerName));
|
||||
if (string.IsNullOrEmpty(controllerName)) throw new ArgumentException("Value can't be empty.", nameof(controllerName));
|
||||
if (controllerAction == null) throw new ArgumentNullException(nameof(controllerAction));
|
||||
if (string.IsNullOrEmpty(controllerAction)) throw new ArgumentException("Value can't be empty.", nameof(controllerAction));
|
||||
if (area == null) throw new ArgumentNullException(nameof(area));
|
||||
|
||||
//need to create a params string as Base64 to put into our hidden field to use during the routes
|
||||
var surfaceRouteParams = $"c={HttpUtility.UrlEncode(controllerName)}&a={HttpUtility.UrlEncode(controllerAction)}&ar={area}";
|
||||
|
||||
//checking if the additional route values is already a dictionary and convert to querystring
|
||||
string additionalRouteValsAsQuery;
|
||||
if (additionalRouteVals != null)
|
||||
{
|
||||
if (additionalRouteVals is Dictionary<string, object> additionalRouteValsAsDictionary)
|
||||
additionalRouteValsAsQuery = additionalRouteValsAsDictionary.ToQueryString();
|
||||
else
|
||||
additionalRouteValsAsQuery = additionalRouteVals.ToDictionary<object>().ToQueryString();
|
||||
}
|
||||
else
|
||||
additionalRouteValsAsQuery = null;
|
||||
|
||||
if (additionalRouteValsAsQuery.IsNullOrWhiteSpace() == false)
|
||||
surfaceRouteParams += "&" + additionalRouteValsAsQuery;
|
||||
|
||||
return surfaceRouteParams.EncryptWithMachineKey();
|
||||
}
|
||||
// /// <summary>
|
||||
// /// This is used in methods like BeginUmbracoForm and SurfaceAction to generate an encrypted string which gets submitted in a request for which
|
||||
// /// Umbraco can decrypt during the routing process in order to delegate the request to a specific MVC Controller.
|
||||
// /// </summary>
|
||||
// /// <param name="controllerName"></param>
|
||||
// /// <param name="controllerAction"></param>
|
||||
// /// <param name="area"></param>
|
||||
// /// <param name="additionalRouteVals"></param>
|
||||
// /// <returns></returns>
|
||||
// internal static string CreateEncryptedRouteString(string controllerName, string controllerAction, string area, object additionalRouteVals = null)
|
||||
// {
|
||||
// if (controllerName == null) throw new ArgumentNullException(nameof(controllerName));
|
||||
// if (string.IsNullOrEmpty(controllerName)) throw new ArgumentException("Value can't be empty.", nameof(controllerName));
|
||||
// if (controllerAction == null) throw new ArgumentNullException(nameof(controllerAction));
|
||||
// if (string.IsNullOrEmpty(controllerAction)) throw new ArgumentException("Value can't be empty.", nameof(controllerAction));
|
||||
// if (area == null) throw new ArgumentNullException(nameof(area));
|
||||
//
|
||||
// //need to create a params string as Base64 to put into our hidden field to use during the routes
|
||||
// var surfaceRouteParams = $"c={HttpUtility.UrlEncode(controllerName)}&a={HttpUtility.UrlEncode(controllerAction)}&ar={area}";
|
||||
//
|
||||
// //checking if the additional route values is already a dictionary and convert to querystring
|
||||
// string additionalRouteValsAsQuery;
|
||||
// if (additionalRouteVals != null)
|
||||
// {
|
||||
// if (additionalRouteVals is Dictionary<string, object> additionalRouteValsAsDictionary)
|
||||
// additionalRouteValsAsQuery = additionalRouteValsAsDictionary.ToQueryString();
|
||||
// else
|
||||
// additionalRouteValsAsQuery = additionalRouteVals.ToDictionary<object>().ToQueryString();
|
||||
// }
|
||||
// else
|
||||
// additionalRouteValsAsQuery = null;
|
||||
//
|
||||
// if (additionalRouteValsAsQuery.IsNullOrWhiteSpace() == false)
|
||||
// surfaceRouteParams += "&" + additionalRouteValsAsQuery;
|
||||
//
|
||||
// return surfaceRouteParams.EncryptWithMachineKey();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user