Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have this query string
strFileName = HttpUtility.UrlPathEncode(Request.QueryString["FileName"].ToString().Trim());

i want to convert this url by encoding which contain special characters and spaces
@#$%^ &(T)_+=-09group-5_idea100_2-25-2015

how can i do this
plz help me ...
Posted
Updated 4-Mar-15 20:18pm
v3
Comments
chenghuichao 5-Mar-15 2:25am    
is it Server.HtmlEncode(urlStr); ?
but we normally use Server.UrlEncode(urlStr); for encoding url.

1 solution

You need to use - Uri.EscapeDataString Method[^].

For example...
C#
var result = Uri.EscapeDataString("a q");
// result == "a%20q"
 
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