<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.no-ip.org/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Craig's Blog : .NET</title><link>http://blogs.no-ip.org/craig/archive/tags/.NET/default.aspx</link><description>Tags: .NET</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>ASP.NET Starter Kits</title><link>http://blogs.no-ip.org/craig/archive/2004/10/13/856.aspx</link><pubDate>Wed, 13 Oct 2004 16:23:00 GMT</pubDate><guid isPermaLink="false">0511061e-8795-4252-a46c-8c82d1f16065:856</guid><dc:creator>craigg75</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.no-ip.org/craig/rsscomments.aspx?PostID=856</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.no-ip.org/craig/commentapi.aspx?PostID=856</wfw:comment><comments>http://blogs.no-ip.org/craig/archive/2004/10/13/856.aspx#comments</comments><description>&lt;p&gt;I just wanted to pass along a cool freebie for those out there who are wanting/trying to learn ASP.NET and want to pick up some cool techniques. Microsoft has created a whole set of starter kits located at &lt;a href="http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx"&gt;http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx&lt;/a&gt; also there's a quick review of them on MSDN -- &lt;a href="http://msdn.microsoft.com/msdnmag/issues/03/08/StarterKits/default.aspx"&gt;http://msdn.microsoft.com/msdnmag/issues/03/08/StarterKits/default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I espcially like the Community kit which is portal web site. This one is fully functional too if you want a free portal. I've been researching how it uses the IHttpModule class to intercept http requests before it gets to the asp.net handler. One of the things that rocks is you can hook into the authentication event handler and perform you're own authentication/authorization. Very cool. The kit dynamically builds each page from a web control and overlays skins. That's kind of neat but I'm not much for skins but I do like the “master page” approach. I plan to hybrid some of it into my own web site. I know that ASP.NET 2.0 will have incorporate master pages as part of the framework. I've been waiting awhile for it to get out of beta. I think I'll just plow ahead with this approach though. &lt;/p&gt;
&lt;p&gt;Another kit that I plan on looking at is the Reports kit. They do a lot of fancy stuff with GDI+ and displaying data via data grids, lists and repeaters. Typical parent-child relationships and such. Something I've been investigating in my new media wishlist component I'm trying to add to my website. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.no-ip.org/aggbug.aspx?PostID=856" width="1" height="1"&gt;</description><category domain="http://blogs.no-ip.org/craig/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.no-ip.org/craig/archive/tags/Craig_2700_s+Life/default.aspx">Craig's Life</category></item><item><title>Zip.NET</title><link>http://blogs.no-ip.org/craig/archive/2004/03/29/436.aspx</link><pubDate>Tue, 30 Mar 2004 03:02:00 GMT</pubDate><guid isPermaLink="false">0511061e-8795-4252-a46c-8c82d1f16065:436</guid><dc:creator>craigg75</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.no-ip.org/craig/rsscomments.aspx?PostID=436</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.no-ip.org/craig/commentapi.aspx?PostID=436</wfw:comment><comments>http://blogs.no-ip.org/craig/archive/2004/03/29/436.aspx#comments</comments><description>&lt;p&gt;I was enhancing my mp3 aspx search page to include a shopping cart function. I figured it would be nice to grab all of the mp3 files, zip them up into one big zip file and dump it into the HTTPResponse stream. Well two missing things: A zip library and a way to stream in the files so I don't have to create an actual hard disk based zip file. Here's how I did it:&lt;/p&gt;
&lt;p&gt;The zip library can be found here -- &lt;a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx"&gt;SharpZipLib&lt;/a&gt; It's open source and a byproduct of the very cool open source SharpDevelop IDE.&lt;/p&gt;
&lt;p&gt;Here's the code:&lt;/p&gt;&lt;font size="1"&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;MemoryStream ms = &lt;/font&gt;&lt;font face="Courier New" color="#0000ff"&gt;new&lt;/font&gt;&lt;font face="Courier New"&gt; MemoryStream();&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;ZipOutputStream s = &lt;/font&gt;&lt;font face="Courier New" color="#0000ff"&gt;new&lt;/font&gt;&lt;font face="Courier New"&gt; ZipOutputStream( ms );&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;s.SetLevel(5); &lt;/font&gt;&lt;font color="#008000"&gt;&lt;font face="Courier New"&gt;// 0 - store only to 9 - means best compression&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;foreach&lt;/font&gt; ( &lt;font color="#0000ff"&gt;int&lt;/font&gt; id &lt;font color="#0000ff"&gt;in&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt; ids ) &lt;font color="#008000"&gt;// primary key ids&lt;br /&gt;&lt;/font&gt;{&lt;br /&gt;  &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt; location = &lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt; MP3DataAccess().GetLocation( id );&lt;br /&gt;  &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;FileInfo fi = &lt;/font&gt;&lt;font face="Courier New" color="#0000ff"&gt;new&lt;/font&gt;&lt;font face="Courier New"&gt; FileInfo( location );&lt;br /&gt;  &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;FileStream fs = File.OpenRead( location );&lt;br /&gt;  &lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;byte&lt;/font&gt;[] buffer = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#0000ff"&gt;byte&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;[ fs.Length ];&lt;br /&gt;  &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;fs.Read( buffer, 0, buffer.Length );&lt;br /&gt;  &lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;ZipEntry entry = &lt;/font&gt;&lt;font face="Courier New" color="#0000ff"&gt;new&lt;/font&gt;&lt;font face="Courier New"&gt; ZipEntry( fi.Name );&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;  s.PutNextEntry( entry );&lt;br /&gt;  &lt;/font&gt;&lt;font face="Courier New" size="2"&gt;s.Write( buffer, 0, buffer.Length );&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;s.Finish();&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;int&lt;/font&gt; streamLength = (&lt;font color="#0000ff"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;)ms.Length;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;ms.Seek( 0, SeekOrigin.Begin );&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;ms.Position = 0;&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;byte&lt;/font&gt;[] buffinal = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#0000ff"&gt;byte&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;[ streamLength ];&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;ms.Read( buffinal, 0, streamLength );&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;ms.Close();&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;Response.ClearContent();&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;Response.ClearHeaders();&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;Response.ContentType = "application/octet-stream";&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;Response.AppendHeader( "content-length", streamLength.ToString() );&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New" color="#0000ff"&gt;string&lt;/font&gt;&lt;font face="Courier New"&gt; uniqueFileName = "mp3s-" + DateTime.Now.ToString( "yyyy-MM-ddTHHmmss" ) + ".zip";&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;Response.AppendHeader( "content-disposition", "inline; filename=" + uniqueFileName ); &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;Response.BinaryWrite( buffinal );&lt;/font&gt;&lt;font size="1"&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.no-ip.org/aggbug.aspx?PostID=436" width="1" height="1"&gt;</description><category domain="http://blogs.no-ip.org/craig/archive/tags/.NET/default.aspx">.NET</category></item></channel></rss>