Archives

Archives / 2013 / May
  • Select, Zip and Download Files displayed in a GridView

    Sometime back I wrote an article that shows how to zip and unzip files programmatically using System.IO.Compression classes. Using these classes along with ASP.NET controls you can allow user user to select one or more files from a list and then programmatically "bundle" these files into a ZIP archive. This short post shows how.

  • Using Cross Origin Resource Sharing (CORS) in ASP.NET Web API

    For security reasons browsers prohibit AJAX calls to resources residing outside the current origin. This means you under the current settings, you can't provide a service exposed by a Web API to some other origin. However, at times you might want to allow a legitimate origin to access a resource. This is where Cross Origin Resource Sharing (CORS) specifications come into the picture. While there are other ways to enable CORS at the web application level, the ASP.NET Web API takes CORS support a step further through certain attributes. Using these attribute you can fine tune CORS at the global level, controller level or individual action level. This article discusses how this support can be used in your applications.

  • Zip and Unzip Files Programmatically in C#

    Most of us deal with Zip files on a daily basis. Normally people use some third-party utility to create, open and extract Zip files. At times you may want to deal with Zip files programmatically. Luckily, .NET framework 4.5 introduces some new classes in System.IO.Compression namespace that allows you to do just that. Using these classes you can create new Zip files, open and modify existing Zip files and extract the contents of Zip files via code. This article examines some of these classes.