public static RouteValueDictionary EncryptRouteValueDictionary(this IEncryptString encrypter, RouteValueDictionary routeValues) { string encryptedParameters = encrypter.Encrypt(routeValues.ToQueryString()); RouteValueDictionary result = new RouteValueDictionary(); result.Add("q", encryptedParameters); return(result); }
static StringEncrypter() { UrlEncrypter = new ConfigurationBasedStringEncrypter(); ControlsEncrypter = new SessionBasedStringEncrypter(); //string EncrypterClassName = ConfigurationManager.AppSettings["StringEncrypter"].ToString(); //if (string.IsNullOrEmpty(EncrypterClassName)) // throw new InvalidOperationException("[StringEncrypter] appSettings key is not defined or has no value."); //Type type = Type.GetType(EncrypterClassName); //UrlEncrypter = (IEncryptString)Activator.CreateInstance(type); }
static StringEncrypter() { UrlEncrypter = new ConfigurationBasedStringEncrypter(); }
public static RouteValueDictionary EncryptObject(this IEncryptString encrypter, object routeValues) { RouteValueDictionary parameters = HtmlHelper.AnonymousObjectToHtmlAttributes(routeValues); return(encrypter.EncryptRouteValueDictionary(parameters)); }