<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JP&#039;s Blog-O-Matic &#187; api</title>
	<atom:link href="http://www.viceclown.com/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.viceclown.com</link>
	<description>tecnology &#124; community &#124; stuff</description>
	<lastBuildDate>Sat, 10 Apr 2010 06:01:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Multipart Form Posts in .NET</title>
		<link>http://www.viceclown.com/2009/08/15/multipart-form-posts-in-net/</link>
		<comments>http://www.viceclown.com/2009/08/15/multipart-form-posts-in-net/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 20:12:23 +0000</pubDate>
		<dc:creator>JP Toto</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.viceclown.com/?p=91</guid>
		<description><![CDATA[Recently I decided I wanted to develop a small, lightweight Windows client to use for Baconfile, Leah Culver&#8216;s latest side project for easily uploading files to Amazon&#8217;s S3 service. Chris Wanstrath made a nice little Mac client and I thought Windows users might enjoy the same type of functionality. After deciding on how I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I decided I wanted to develop a small, lightweight Windows client to use for <a title="Bacon File" href="http://baconfile.com" target="_blank">Baconfile</a>, <a title="Leah Culver" href="http://leahculver.com/" target="_blank">Leah Culver</a>&#8216;s latest side project for easily uploading files to Amazon&#8217;s S3 service.<a title="Chris Wanstrath" href="http://defunkt.github.com/" target="_blank"> Chris Wanstrath</a> made a nice little <a title="Bacondrop" href="http://baconfile.com/defunkt/bacondrop/" target="_blank">Mac client</a> and I thought Windows users might enjoy the same type of functionality.</p>
<p>After deciding on how I wanted the app to look and feel, I got to work. At least, I tried to. Strait away I ran into issues in both trying to write a Windows Explorer extension in .NET and POSTing a multi-part form POST. I don&#8217;t want to devolve into too much of a rant but it IS 2009 and we STILL can&#8217;t write simple Explorer extensions using managed code which just reinforces my feeling that .NET programmers are second-class Windows citizens. Version 4.0 is around the corner and I still have to import kernel32.dll to perform some basic OS functions.</p>
<p>The other problem, POSTing a multi-part form POST turned out to be a little bit more surmountable an issue. The goal was to use the <a title="Baconfile API" href="http://baconfile.com/api/" target="_blank">Baconfile API</a> to upload a file. In other languages such as Ruby, constructing a multi-part form post is actually quite simple. In C# it is not. Between <a title="HttpWebRequest on MSDN" href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx" target="_blank">HttpWebRequest</a> and the <a title="WebClient on MSDN" href="http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx" target="_blank">WebClient </a>Upload method, there was no way to create a custom post whereby I added some arbitrary number of POST parameters.</p>
<p>After awhile I found<a title="Brian Ginstead" href="http://www.briangrinstead.com/blog/" target="_blank"> Brian Grinstead</a>&#8216;s <a title="Brian Ginstead - Multipart Form Post" href="http://www.briangrinstead.com/blog/multipart-form-post-in-c/comment-page-1#comment-242" target="_blank">post</a> about how he had constructed his own class that enabled users to create their own custom-formed multi-part form POST. Considering how often a function like this is used, especially on public APIs, I was as surprised as he was that this kind of functionality wasn&#8217;t in the .NET framework itself. His example class worked flawlessly.</p>
<p>I needed to add some tweaks such as basic http auth and so I created a <a title="Multi-part_form_poster GitHub project" href="http://github.com/jptoto/multipart_form_poster/tree/master" target="_blank">new GitHub project</a> to support the work.</p>
<p>I plan to add more functions such as a cookie container, ActiveDirectory auth, and whatever else seems logical. If I&#8217;ve missed something and there really IS an easy way to do this using out-of-the-box classes in the .NET framework, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.viceclown.com/2009/08/15/multipart-form-posts-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
