remove HTML tags in string

How to remove HTML tags in content or string? We can remove HTML tags in string; it is little bit easy using Regex in .net. Here is the code for removing HTML tags for content or string. Code is in C#.net. First import namespace called System.Text.RegularExpressions. Code:- using System.Text.RegularExpressions; Then create one method like this below Code :- #region reusable regex's protected static Regex htmlRegex = new Regex("<[^>]+>|\ \;", RegexOptions.IgnoreCase | RegexOption...
Read More

Embed Image in E-Mail is Easy in C#

Embed Image in mail How to add logo in mail? How to add an image object in mail with out having any static URL? (for example <img src="http://shareourideas.com/wp-content/uploads/2010/03/twitter_logo_header.png" />) Here best solution for this…! C# Code :- Import this Net.Mail and Net.Mime using System.Net.Mail; using System.Net.Mime; //Then use this code in button click or your own function { string strMailContent = "Here is your mail content…."; string fromAddress = "your-email@[your...
Read More

String Format for DateTime in C#

String Format for DateTime in C# To Custom DateTime Format There are following custom format specifiers is available y (year), M (month), d (day), h (hour 12), H (hour 24), m (minute), s (second), f (second fraction), F (second fraction, trailing zeroes are trimmed), t (P.M or A.M) and z (time zone). // create date time 2008-03-09 16:05:07.123 DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123); String.Format("{0:y yy yyy yyyy}", dt); // "9 09 009 2009" year String.Format("{0:M MM MM...
Read More