- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This code has been used to encrypt and decrypt query string .No matter what the lenght of the url is ,this code will encrypt the key and the value the query string into 25 digit
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;
using System.Collections;
using System.Web;
namespace BusinessLayer
{
public class QueryString : NameValueCollection
{
private string document;
public string Document
{
get
{
return document;
}
}
public QueryString()
{
}
public QueryString(NameValueCollection clone): base(clone)
{
}
//################################################## ###############################################
//This Class Has been used to get the URl from the address browser of the page
// http://www.hanusoftware.com
//################################################## ###############################################
//this method has been used to get the current URL of the page
public static QueryString FromCurrent()
{
//returns the current url from the address bar
return FromUrl(HttpContext.Current.Request.Url.AbsoluteUr i);
}
///
/// This method has been used to divide the Address URl into characters chunks
///
///
}
///
/// This method clear all exceptions in the passed string
///
///
}
///
/// this is the usual method which has to call clear all exceptions
///
///
}
}
foreach (string s in toRemove)
this.Remove(s);
}
///
/// this method adds the key value pairs in QueryString of the URL
///
///
else
base.Add(name, value);
}
public override string ToString()
{
return ToString(false);
}
///
/// this ethod has been used to join all the characters array to the URL
///
///
string[] parts = new string[this.Count];
string[] keys = this.AllKeys;
//for each keys breaks the URL into chunks
for (int i = 0; i < keys.Length; i++)
parts = keys + "=" + HttpContext.Current.Server.UrlEncode(this[keys]);
string url = String.Join("&", parts);
if ((url != null || url != String.Empty) && !url.StartsWith("?"))
url = "?" + url;
if (includeUrl)
url = this.document + url;
return url;
}
}
}
Link Copied

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page