URL Encoding

This is a discussion on URL Encoding within the C# Programming forums, part of the General Programming Boards category; If I have a string like "Hello world" Whats an easy way to encode the string (URL encoding style) so ...

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986

    URL Encoding

    If I have a string like

    "Hello world"

    Whats an easy way to encode the string (URL encoding style) so when printed it reads

    "Hello%20world".

    Using C# and .NET?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    string encoded = System.Web.HttpUtility.UrlEncode( "Hello World" );

    Never used that method, maybe the call needs some tweaking
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Worked perfectly, thanks nvoigt!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. URL escape issue
    By George2 in forum C# Programming
    Replies: 2
    Last Post: 08-12-2008, 11:45 AM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. frustration on URL encode-decode
    By Lince in forum C Programming
    Replies: 22
    Last Post: 08-22-2007, 05:36 PM
  4. Replies: 1
    Last Post: 07-02-2007, 09:22 AM
  5. Url query encoding/decoding
    By Niara in forum Networking/Device Communication
    Replies: 6
    Last Post: 04-25-2007, 03:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21