Encoding URL Strings in C# : URL Encode Decode « Server « ASP.Net






Encoding URL Strings in C#

<%@ Page Language="C#" %>
<html>
<head>
   <title>Encoding URL Strings</title>
   <script runat="server">

      void UrlPathEncode()
      {
         string StrToEncode;
         string StrToReturn;

         StrToEncode = "UrlPathEncode.aspx? Arg = foo";
         StrToReturn = Server.UrlPathEncode(StrToEncode);
         Response.Write("<a href=\"" + StrToReturn + "\">" + StrToReturn + "</a>");

      }

   </script>
</head>
<body>

<% UrlPathEncode(); %>

</body>
</html>

           
       








Related examples in the same category

1.Decoding Encoded HTML Strings (VB.net)
2.Encoding URL Strings (VB.net)
3.Encoding URL Strings in VB.net
4.Encoding HTML Strings (VB.net)
5.Server.HtmlEncode (VB.net)
6.URL Encode and Decode Demo (VB.net)