Avaricesoft’s Weblog

Just another WordPress.com weblog

Encoding URL Strings in ASP.net using C#

Posted by avaricesoft on August 4, 2008

<%@ 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>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.