Skip to main content

Posts

code to send Mail From Web Application using c sharp

using System.Web.Mail; using System; public class MailSender { public static bool SendEmail( string pGmailEmail, string pGmailPassword, string pTo, string pSubject, string pBody, MailFormat pFormat, string pAttachmentPath ) { MailMessage myMail = new MailMessage(); myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","smtp.gmail.com"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/smtpserverport","465"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendusing","2"); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1"); //Use 0 for anonymous myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendusername",pGmailEmail); myMail.Fields.Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword&q

Encrypt Decrypt password using asp dot net

using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Security.Cryptography; namespace xyz { class abc { public static string Encrypt(string plainText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize) { // Convert strings into byte arrays. // Let us assume that strings only contain ASCII codes. // If strings include Unicode characters, use Unicode, UTF7, or UTF8 // encoding. byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); // Convert our plaintext into a byte array. // Let us assume that plaintext contains UTF8-encoded characters. byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText); // First, we must create a password, from which the key will be derived. // This password will be generated from the specified passphrase and

Code help with example of crystal Reports

Export Crystal Report to Excel Sheet MemoryStream oStream; // using System.IO oStream = (MemoryStream) rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel); Response.Clear(); Response.Buffer = true; Response.ContentType = "appliaction/ms-excel"; Response.BinaryWrite(oStream.ToArray()); Response.End() Export Crystal Report to Excel ReportDocument rpt=new ReportDocument();//set a ReportPath and assign the dataset to reportdocument objectrpt.Load(Server.MapPath("Report1.rpt")); rpt.SetDataSource(ds); //assign the values to crystal report viewerCrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); //Exporting PDFMemoryStream oStream; // using System.IOoStream = (MemoryStream)rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true;Response.ContentType = "application/pdf"; Response.BinaryWrite(oStream.To

Ajax examples in asp.net

Customize Ajax Editor Control using System;using System.Data; using System.Configuration; using System.Linq;using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq;using AjaxControlToolkit.HTMLEditor; /// /// Summary description for customEditor /// /// namespace myControls { public class customEditor : Editor { public customEditor() { // // TODO: Add constructor logic here // } protected override void FillTopToolbar() { TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Copy()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.ToolbarButton.Cut()); TopToolbar.Buttons.Add(new AjaxControlToolkit.HTMLEditor.T

Why the colour of tyre is black?

Why the colour of tyre is black.? In the starting days of invention of tyres, black coloured tyres were rarely seen. The general rubber used in the manufacture of tyres was brown in colour. So the tyres were also in the brown colour. But the black colour which is presently used is the unexpected result in an experiment. In 1885, a tyres manufacturing company named M/s. B F Good Rich has tried with dark colour in the manufacture of tyres so that dust and dirt will not be visible clearly. They used black coloured carbon material in the mixture used to make tyres. They observed that the black coloured tyres thus manufactured not only had colour difference but also were 5 times more durable than the brown coloured ones and from then they started mfg black coloured tyres. Though the latest models of tyres have acquired the qualities of strength and different styles but the black colour is not changed. It is because of the presence of carbon black. It is used to improve the life of ti

use of compilers and interpreters as Language translators

Language is for communication. In order to communicate with 2 person, we need a common language. If no such language exists, we need a translator to perform the communication. In case of computers, it can understand only electric pulses(Digital Signals). We will represent the signals using binary number system(1/0 for low/ high). But writing a program in binary is very difficult (technically, not feasible). So for ease of use we can use some words to group common operations and these mnemonic language is called as assembly language. Still, writing big programs are very difficult in assembly language. And the programs written in one machine may not work in other machines. So a situation arise to create a more generic, platform independent, easy to use, simple to debug language, and a program written in this language should be easy maintainable. A translator program for a computer accepts a program written in a language, which is not understandable by the computer and translate to th

List of good C++ books

For the beginner ---------------- 1. C++ Primer - Stan Lippman, Joseé Lajoie 2. Thinking in C++ (vol 1 & 2) - Bruce Eckel For the intermediate programmer (perhaps new to C++) ------------------------------------------ 1. Accelerated C++ - Andrew König, Barbara Moo 2. The C++ Standard Library: Tutorial and Reference Guide - Nicolai M Josuttis 3. C++ Templates - Nicolai M Josuttis, David Vandevoorde For the practising C++ programmer ------------------------------------------ 1. The C++ Programming Language - Bjarne Stroustrup 2. Effective C++ 3/e - Scott Meyers 3. More Effective C++ - Scott Meyers 4. Effective STL - Scott Meyers 5. More C++ Gems - ed Robert Martin 6. The STL Tutorial and Reference Guide - Dave Musser, Atul Saini (the ANSI standard edition) 7. Exceptional C++ - Herb Sutter 8. The C++ Standard Library Extensions: A tutorial and reference - Pete Becker 9. More Exceptional C++ - Herb Sutter 10. C++ Common Knowledge - Steve Dewhurst 11. Beyond the C