コード例 #1
0
        public static RouteValueDictionary EncryptObject(this IEncryptString encrypter, object routeValues)
        {
            RouteValueDictionary parameters = HtmlHelper.AnonymousObjectToHtmlAttributes(routeValues);

            return(encrypter.EncryptRouteValueDictionary(parameters));
        }
コード例 #2
0
        /// <summary>
        /// Returns an anchor element (a element) that contains the virtual path of the specified action, with an encrypted routeValues.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper instance that this method extends.</param>
        /// <param name="linkText">The inner text of the anchor element.</param>
        /// <param name="actionName">The name of the action.</param>
        /// <param name="routeValues">An object that contains the parameters for a route.</param>
        /// <returns>An anchor element (a element) with encrypted routeValues.</returns>
        /// <exception cref="System.ArgumentException">The linkText parameter is null or empty.</exception>
        public static MvcHtmlString EncryptedActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, RouteValueDictionary routeValues)
        {
            RouteValueDictionary parameters = encrypter.EncryptRouteValueDictionary(routeValues);

            return(htmlHelper.ActionLink(linkText, actionName, parameters));
        }
コード例 #3
0
        /// <summary>
        /// Generates a fully qualified and encrypted URL to an action method for the specified action name and route values.
        /// </summary>
        /// <param name="actionName">The name of the action method.</param>
        /// <param name="routeValues">An object that contains the parameters for a route.</param>
        /// <param name="helper">The HTML helper instance that this method extends.</param>
        /// <returns>The fully qualified and encrypted URL to an action method.</returns>
        public static string EncryptedAction(this UrlHelper helper, string actionName, RouteValueDictionary routeValues)
        {
            RouteValueDictionary parameters = encrypter.EncryptRouteValueDictionary(routeValues);

            return(helper.Action(actionName, parameters));
        }