How to send simple text mail in ASP.NET
VB.NET Dim mail As New MailMessage() mail.To = ‘[email protected]’ mail.From = ‘[email protected]’ mail.Subject = ‘Test.’ mail.Body = ‘Test Message’ SmtpMail.SmtpServer = ‘localhost’ ’your real server goes here SmtpMail.Send(mail) C# MailMessage mail = new MailMessage(); mail.To = ‘[email protected]’; mail.From = ‘[email protected]’; mail.Subject = ‘Test.’; mail.Body = ‘Test Message’; SmtpMail.SmtpServer = ‘localhost’; //your real server goes here SmtpMail.Send( mail );
How do I add the Reply-To header to the MailMessage
VB.NET mail.Headers.Add( ‘Reply-To’, ‘[email protected]’ ) C# mail.Headers.Add( ‘Reply-To’, ‘[email protected]’ );
How to set the vertical align of a TableCell programmatically
VB.NET Dim tbl As New TableCell() ’VerticalAlign is enumeration in System.Web.UI.WebControls namespace tbl.VerticalAlign = VerticalAlign.Top C# TableCell tbl=new TableCell(); //VerticalAlign is enumeration in System.Web.UI.WebControls namespace tbl.VerticalAlign = VerticalAlign.Top;
How to save an xml-string into an Xml document
VB.NET Dim xmlText As String = ‘Node1Node2’ Dim xmlDoc As New XmlDocument xmlDoc.LoadXml(xmlText) Dim writer As XmlTextWriter = New XmlTextWriter(Server.MapPath(‘data.xml’), Nothing) writer.Formatting = Formatting.Indented xmlDoc.Save(writer) C# string xmlText = ‘Node1Node2’; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlText); XmlTextWriter writer = new XmlTextWriter(Server.MapPath(‘data.xml’),null); writer.Formatting = Formatting.Indented; xmlDoc.Save(writer);
How to convert user input in dMy format to Mdy
VB.NET Dim dt As DateTime = DateTime.ParseExact(‘0299’, New String() {‘My’, ‘M/y’}, Nothing, System.Globalization.DateTimeStyles.None) C# DateTime dt = DateTime.ParseExact(‘0299’, new string[] {‘My’,’M/y’}, null,System.Globalization.DateTimeStyles.None); For more details refer DateTime.ParseExact