Skip to main content

Posts

ASP.NET Core

What is ASP.NET Core?   ASP.NET Core is an open source cross platform framework to build web applications, IoT application and mobile backend applications. These application run on .NET Core or the full .NET framework. These application can be deployed in could or run on premises. It is a cross platform framework hence we can run on Windows, Mac and Linux. You can found the open source in GitHub in the following url https://github.com/aspnet/home   Advantages of ASP.NET Core   You can build Web UI and APIs in the same application You can integrate modern client side frameworks and development workflows It is a cloud ready environment based configuration system It has its own build in dependency injection It has light weight and modular HTTP request pipeline You can host the application in IIS or any other web server of your choice It support side by side application versioning It can be entirely shipped as a NuGet packages There are ...

Email preheader

What is email pre-header? Email pre-header is the short summary of text to denote the email content when the user look the email list. It is usually showed next to the subject line. How we add pre-header into email? It is usually surrounded by hidden span and prefix with the email body. for example <span style="display:none !important">This is email preheader</span> Why we use pre-header? Pre-header used to display the short summary of the email content before opening the email. So it improves the open and click rate in a drastic way.

Cascading Style Sheets CSS

What is CSS? Cascading style sheets is a markup language to define styles. This is mostly used in html but we can also use the same for any XML based markup languages.  It allows to adopt for different types of devises  like Desktop, large screen, small screen, iPad, mobile, printers etc. Why we need CSS? CSS mainly used for the following benefits. It improves the readability of the base html/XML markup language It is independent to the base markup language, hence it can be used again and again for the same page or more than one pages (it is reusable). It is simple, no programming languages or complex algorithm is required. Different devices can be defined in a single CSS. So the same CSS can be used for different devices. It reduces the usages of JavaScript for some simple use cases. We cannot define style or attributes to html markup for event like mouse up, mouse over events. How we apply CSS? CSS can be apply to the a html/xml by using classes o...

Time zone offset for time zone id in C#

TimeZone Offset Dateline Standard Time -720 UTC-11 -660 Hawaiian Standard Time -600 Alaskan Standard Time -540 Pacific Standard Time (Mexico) -480 Pacific Standard Time -480 US Mountain Standard Time -420 Mountain Standard Time (Mexico) -420 Mountain Standard Time -420 Central America Standard Time -360 Central Standard Time -360 Easter Island Standard Time -360 Central Standard Time (Mexico) -360 Canada Central Standard Time -360 SA Pacific Standard Time -300 Eastern Standard Time (Mexico) -300 Eastern Standard Time -300 Haiti Standard Time -300 US Eastern Standard Time -300 Venezuela Standard Time -270 Paraguay Standard Time -240 Atlantic Standard Time -240 Central Brazilian Standard Time -240 SA Western Standard T...

How to post a dynamic form using json data?

// Post dynamic form using json data   function post(uri, data, method) { // when method not provided use default post method method = method || "post" ;     var form = document.createElement( "form" ); form.setAttribute( "method" , method); form.setAttribute( "action" , uri); for ( var property in data) {   if (params.hasOwnProperty(property)) {     var hiddenField = document.createElement( "input" );     hiddenField.setAttribute( "type" , "hidden" );     hiddenField.setAttribute( "name" , property);     hiddenField.setAttribute( "value" , data[property]);      form.appendChild(hiddenField);   } } document.body.appendChild(form); form.submit(); }

How to Gzip and export a csv stream in web usig c#

using System.IO.Compression; public static void ExportAsGZip(Stream stream, string fileName) {     HttpContext.Current.Response.ContentType = "application/gzip";     HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.gz", fileName));     using (GZipStream compressionStream = new GZipStream(HttpContext.Current.Response.OutputStream, CompressionMode.Compress))     {       stream.CopyTo(compressionStream);     } }  

Generic method to convert enum datatype to select list item

// Generic method to convert enum datatype to select list items public static List < SelectListItem > GetEnumSelectListItems<T>() {     List < SelectListItem > list = new List < SelectListItem >();     foreach (T type in Enum .GetValues( typeof (T)))     {         list.Add ( new SelectListItem ()  {              Selected = false ,             Text = type.ToString(),             Value = type.ToString()         } );     }     return list; }