Copy Code code as follows:
Remove the specified parameter #region URL
<summary>
To remove the specified parameter
</summary>
<param name= "url" > Address </param>
<param name= "param" > Parameters </param>
<returns></returns>
public static string BuildUrl (string url, string param)
{
string url1 = URL;
if (URL. IndexOf (param) > 0)
{
if (URL. IndexOf ("&", URL. IndexOf (param) + param. Length) > 0)
{
URL1 = URL. Substring (0, URL. IndexOf (param)-1) + URL. Substring (URL. IndexOf ("&", URL. IndexOf (param) + param. Length) + 1);
}
Else
{
URL1 = URL. Substring (0, URL. IndexOf (param)-1);
}
return URL1;
}
Else
{
return URL1;
}
}
#endregion
#region "Get page URL"
<summary>
Get the current access page address parameter
</summary>
public static string getscriptnamequerystring
{
Get
{
return httpcontext.current.request.servervariables["Query_string"]. ToString ();
}
}
<summary>
Get the current access page address
</summary>
public static string Getscriptname
{
Get
{
return httpcontext.current.request.servervariables["Script_name"]. ToString ();
}
}
<summary>
Get the current access page URL
</summary>
public static string Getscripturl
{
Get
{
return getscriptnamequerystring = = ""? Getscriptname:string. Format ("{0}?{ 1} ", Getscriptname, getscriptnamequerystring);
}
}
<summary>
Get current access page parameters
</summary>
public static string Getscriptnamequery
{
Get
{
return HttpContext.Current.Request.Url.Query;
}
}
#endregion
To get rid of multiple parameters, use it. BuildUrl (BuildUrl (BuildUrl (url,param1), param2), param3)