Krunal Mevada

Because there’s always more to learn

  • My First MVC Application

    Everywhere, in weblogs, i read about the MVC Beta.

    After reading decided to build a small application and tried to develop sample tasklist mvc application by following the First Tutorial.

    I enjoyed it and getting working on VS 2008 & its development web server.

    Then, i had published it to my iis 5.1 (i am using windows xp sp2 and vs2008).

    And then the things were goes wrong. Got stuck in "page not found error".

    I look around on the net for this, and got one solution for this.

    For that i have to change the Global.asax & little configuration in IIS

    Global.asax Change:
                    "Default",                                              // Route name
                    "{controller}.mvc/{action}/{id}",                           // URL with parameters
                    new { controller = "Home", action = "Index", id = "" }  // Parameter defaults

    IIS Config Change:
    Map the extension (.mvc) in IIS to the pipeline

    It will looks like this : http://localhost/TaskList/Home.mvc

  • Extract Zip File In ASP.NET

    Extract your zip file in using OpenSource Zip Library in (SharpZipLib)

    .NET Classes used :

  • using System;
  • using System.IO;
  • using ICSharpCode.SharpZipLib.Zip;

  • I have used open source zip library. Which you have to download from

    Put ICSharpCode.SharpZipLib.DLL into your bin folder of application.

    Use Following function to extract zip file. Assign your zipfilename in ZipFileName variable.

    You Need Folder Rights to Create File Programmatically.

    string ZipFileName = "";


               if (!File.Exists(Server.MapPath(ZipFileName)))
                   lstProcess.Items.Add("File Does Not Exists.");

               using (ZipInputStream s = new ZipInputStream(File.OpenRead(Server.MapPath(ZipFileName))))

                   ZipEntry theEntry;
                   while ((theEntry = s.GetNextEntry()) != null)
                      string directoryName = Path.GetDirectoryName(theEntry.Name);
                       string fileName = Path.GetFileName(theEntry.Name);

                       // create directory
                       if (directoryName.Length > 0)

                       if (fileName != String.Empty)
                           using (FileStream streamWriter = File.Create(Server.MapPath(theEntry.Name)))

                               int size = 2048;
                               byte[] data = new byte[2048];
                               while (true)
                                   size = s.Read(data, 0, data.Length);
                                   if (size > 0)
                                       streamWriter.Write(data, 0, size);
           catch (Exception ex)
               //Display Error
               //Update Status