Posts

How to enable SSL for IIS Express for DEV env in Visual Studio

Image
How to enable SSL for IIS Express for DEV env in Visual Studio: For already developed projects, after we download it from TFS, if the SSL is enabled, then we need to configure the SSL for IIS Express manually with a self signed  certificate. First, we tell IIS Express to enable SSL for the required site that has been configured on a specific port. eg: https://localhost:44037 The command for the above is as below... cd C:\Program Files (x86)\IIS Express IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:44037/ -UseSelfSigned  After we run the above command for the required sites to be run on SSL, we start running the application. Initially, ASP.NET will ask you to create a self signed certificate for the localhost. After accepting it, a self signed cert will be created under the Local Computer account of the cert store. This cert will be used for the IIS Express to work on SSL. Later you need to tell IIS Express to trust this certificate for the application t...

AP.NET WEBAPI: Compress a CSV file and Send the Response as ZIP

WEB API: Compress a CSV file and Send the Response as ZIP In ASP.NET WEB API, we can create an API call for sending the file in  response. Which means that the user can call an URL and gets the required file as a download. Zipping a file in earlier versions of dotnet framework 4.0 was quite lengthy (sometimes it has needed to use third part tools). From 4.5 on wards, we have an assembly for that task specifically with one single line of code. C# code for the API: We need to add reference of System.IO.Compression.FileSystem to the project and use the below using statement to make the ZIP statement work. using System.IO.Compression;   Once the steps are done, need to map the directory to store the generated CSV file temporarily. Once mapping is done, write all text content the the file. Need to provide the final zip file name along its path (fully qualified file name). Zip.CreateFromDirectory is the important line to ZIP. It just takes the source folder contents, zip...