Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi everyone,
i need to pass one city name to another page using query string.its like
'Coeur d 'Alene' but its considering only before single quote like 'Coeur d'
so please provide me solution soon.......
Posted
Comments
Herman<T>.Instance 21-Jan-13 7:23am    
\'
Suresh Dasari's 21-Jan-13 7:46am    
its working here without decoding
public partial class Aspx_ZSamples_Default10 : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default11.aspx?Value='Coeur d 'Alene'");
}
}


public partial class Aspx_ZSamples_Default11 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strValue = Request.QueryString["Value"].ToString();
string strValue1 = HttpUtility.HtmlDecode(Request.QueryString["Value"].ToString());
}
}

You could consider using HttpUtility.UrlEncode[^]. This will help you escape quote symbol.
 
Share this answer
 
Comments
fjdiewornncalwe 21-Jan-13 9:55am    
+5. The correct way to do this.
Abhinav S 21-Jan-13 10:30am    
Thank you Marcus.
before adding any data to the querystring you should always do a Server.UrlEncode on that. after retrieving the data you should do Server.UrlDecode on query string to get the actual data out of it.

http://msdn.microsoft.com/en-us/library/ms525738(v=vs.90).aspx[^]
http://msdn.microsoft.com/en-us/library/6196h3wt.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900