public void OnAuthorization(AuthorizationContext filterContext)
        {
            var routedata = filterContext.RouteData;
            var ritem     = routedata.Values["id"];

            if (ritem == null)
            {
                throw new InvalidOperationException("Hiányzó Id");
            }
            routedata.Values.Remove("id"); //Lecseréljük

            var    provided      = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);
            var    decoded       = StringEncoderHelper.GetDecoded((string)ritem);
            string rootinputname = string.Empty;

            if (!(decoded is IEnumerable))
            {
                rootinputname = "id";
            }
            EncryptedValueProviderFactoryBase.AddToProvidedList(provided, rootinputname, decoded);
            foreach (KeyValuePair <string, object> keyValuePair in provided)
            {
                routedata.Values.Add(keyValuePair.Key, keyValuePair.Value);
            }
        }
        public override IValueProvider GetValueProvider(ControllerContext controllerContext)
        {
            var provided = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

            try
            {
                //Megkeressük a hobj- karakterekkel kezdodő input elemeket
                foreach (string inputname in
                         controllerContext.HttpContext.Request.Form.Keys.Cast <string>()
                         .Where(inputname =>
                                inputname.StartsWith(SecurityHtmlExtension.SecurityHiddenFieldNamePrefix)))
                {
                    //levágjuk az input név elejéről a hobj- -et
                    string rootinputname = inputname.Substring(SecurityHtmlExtension.SecurityHiddenFieldNamePrefix.Length);
                    //Visszaalakítjuk a szöveges adatot objektummá
                    var decoded = StringEncoderHelper.GetDecoded(controllerContext.HttpContext.Request.Form[inputname]);
                    //Rekurzívan bejárva az objektumot feltöltjük a szótárat azokkal
                    //a property path-okkal, amikhez tudunk értéket szolgáltatni
                    AddToProvidedList(provided, rootinputname, decoded);
                }

                if (provided.Count == 0)
                {
                    return(null);
                }
                return(new DictionaryValueProvider <object>(provided, System.Globalization.CultureInfo.CurrentCulture));
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Hibás adat", ex);
            }
        }
        public static MvcHtmlString EncodedActionLink(this HtmlHelper htmlHelper, string title, string action, string controller, Dictionary <string, object> routeData)
        {
            var routeValues = new RouteValueDictionary();

            routeValues.Add("id", StringEncoderHelper.GetEncodedString(routeData));

            return(MvcHtmlString.Create(HtmlHelper.GenerateLink(htmlHelper.ViewContext.RequestContext,
                                                                htmlHelper.RouteCollection, title, (string)null, action, controller,
                                                                routeValues, null)));
        }
        public static MvcHtmlString EncodedHidden(this HtmlHelper htmlHelper, string name, object value)
        {
            if (value == null)
            {
                return(MvcHtmlString.Empty);
            }

            var encoded = StringEncoderHelper.GetEncodedString(value);

            return(InputExtensions.Hidden(htmlHelper, SecurityHiddenFieldNamePrefix + name, encoded));
        }