C# sees the \ as an escape character. Try:
Server.UrlEncode(strPageTitle).Replace("'", @"\'");
or
Server.UrlEncode(strPageTitle).Replace("'", "\\'");
>Hi everybody,
>
>Ok, this is what I expected, but why it doesn't work and how can I make a replace?
>
>"I'm a girl"
>Server.UrlEncode(strPageTitle).Replace("'","\'")
>"I'm+a+girl"
>
>I need to replace ' with a \' and the Replace doesn't work perhaps from the overloading. I'm not profficient in C# to know the different syntax, can someone please give me a hand on this simple question?
>
>Thanks a lot in advance.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer