none
Passing values in querystring RRS feed

  • Question

  • Hi, I've a webpart and I need to catch the value passed by querystring.
    The problem is that when I try to pass strings with special characters like "ç" or "ã" the values that I catch are not the correct ones.
    For exemple for 'k=serviços' in the url I get 'servios'.
    I've tryed to pass encoded values like 'servi%E7os' but the value that I get is the same 'servios'.
    What can I do?

    My code is

    String _texto = HttpContext.Current.Request.QueryString["k"] != null ? HttpContext.Current.Request.QueryString["k"].ToString() : String.Empty;

    Thanks

    .:ebgirl
    Wednesday, July 22, 2009 10:28 AM

Answers

  • It's because you do not encode it properly. The right encoding for serviços is servi%c3%a7os. If you generate the URL using any server side component, you can just use Page.Server.UrlEncode()
    SharePoint Content Rating & more free stuff - http://sptoolbasket.codeplex.com http://www.silver-it.com
    • Marked as answer by ebgirl Wednesday, July 22, 2009 11:18 AM
    Wednesday, July 22, 2009 11:11 AM