Skip to main content

Compress folder in C#

In .NET earlier version, we used to depends on third party dll to generate the compressed files in .zip format. Suppose we have to compress multiple folders, then have to compress each and every folders and files. In .NET framework 4.5 introduced ZipFile class. It helps to compress the folders by one line.

      ZipFile.CreateFromDirectory(startPath, zipPath);

StartPath - Source directory
ZipPath - Compressed file.

Alternatively you could extract the compressed files by 

       ZipFile.ExtractToDirectory(zipPath, extractPath);


more details, click here

Comments

Popular posts from this blog

How to Update Burp Suite in Kali Linux

Download the latest Jar file Navigate to /usr/bin and rename burpsuite to burpsuite(old) Copy the jar that was just downloaded into /usr/bin Right-click and rename the jar to burpsuite , and Allow executing file as program Upon successful launch, you can delete burpsuite(old) from /usr/bin.

Install Grub Customizer in Debian based OS

Always we are looking to customize the boot menu, boot order, boot background image and changing the font & color. These things can be achieved by Grub Cusomizer in Linux. Follow the below steps to install latest version of Grub Cusomizer into Debian based OS (Kali, Parrot) Open the terminal, execute the following commands in order. 1. su - 2. apt-get install build-essential cmake libgtkmm-3.0-dev libssl-dev gettext libarchive-dev  3. wget https://launchpad.net/grub-customizer/5.0/5.0.6/+download/grub-customizer_5.0.6.tar.gz 4. tar xfv grub-customi*  5. cd grub-customizer-5.0.6 6. cmake . && make -j3  7. make install More information, Visit Grub Customizer site - https://launchpad.net/grub-customizer

Request.ServerVariables["LOGON_USER"] returning empty ??

In Intranet application, we used to perform Windows Authentication to validate user. In ASP.NET, Request.ServerVariables["LOGON_USER"] is returning logged user name with domain value. but sometime when we are trying to access this server variable in web application it may return empty value. To resolve the issue, go to Web Site  / Web application project properties set Anonymous Authentication as Disabled and set Windows Authentication as Enabled. that's it. It will resolve the issue. Now can access all the server variables in web application