Click here to Skip to main content
13,288,520 members (68,924 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Samples » Downloads

Stats

95.1K views
581 downloads
65 bookmarked
Posted 24 Aug 2005

UrlBuilder Part II - Encoded QueryStrings

, 29 Sep 2005
Taking UrlBuilder to the next level.
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="CraigLabs.Web._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>Default</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<span style="FONT-SIZE: 18pt; FONT-FAMILY: verdana">UrlBuilder Examples</span>
			<br /><hr width="650" align=left />

<span style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; font-weight: bold">DefaultEncoder</span><br />
<pre style="color: green">
private void DoDefaultEncoder() {
	string url = "http://localhost/CraigLabs.Web/Default.aspx?a=1&b=2&c=3";

	UrlBuilder builder = new UrlBuilder(url);

	builder.QueryString["d"] = "4";
	builder.QueryString["e"] = "5";
	builder.QueryString["f"] = "6";

	litDefaultEncoder.Text += builder.ToString();
}
</pre>
			<span style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">
				<b>Output: </b><asp:Literal ID="litDefaultEncoder" Runat="server"></asp:Literal>
			</span>
			
			<br /><hr width="650" align=left />
			
<span style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; font-weight: bold">Base64Encoder</span><br />
<pre style="color: green">
private void DoBase64Encoder() {
	string url = "http://localhost/CraigLabs.Web/Default.aspx?a=1&b=2&c=3";

	UrlBuilder builder = new UrlBuilder(url, new Base64Encoder());

	builder.QueryString["d"] = "4";
	builder.QueryString["e"] = "5";
	builder.QueryString["f"] = "6";

	litBase64EncoderEncoded.Text = builder.ToString();
	litBase64EncoderPlaintext.Text = builder.ToString("p");
}
</pre>
			<span style="FONT-SIZE: 8pt; FONT-FAMILY: verdana">
				<b>Output: </b><asp:Literal ID="litBase64EncoderEncoded" Runat="server"></asp:Literal>
				<br /><br />
				<b>Output: </b><asp:Literal ID="litBase64EncoderPlaintext" Runat="server"></asp:Literal>
			</span>
			
			<br /><hr width="650" align=left />
		</form>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

lotuspro
Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 29 Sep 2005
Article Copyright 2005 by lotuspro
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid