Wednesday, March 23, 2011

Send mail from asp.net

1. Create a MailHelper class.

public class MailHelper
    {
        public static void SendMailMessage(string from, string to, string bcc, string cc, string subject, string body)
        {
            MailMessage mMailMessage = new MailMessage();
            mMailMessage.From = new MailAddress(from);
            mMailMessage.To.Add(new MailAddress(to));

            if (!(string.IsNullOrEmpty(bcc)))
            {
                mMailMessage.Bcc.Add(new MailAddress(bcc));
            }

            if (string.IsNullOrEmpty(cc))
            {
                mMailMessage.CC.Add(new MailAddress(cc));
            }

            mMailMessage.Subject = subject;
            mMailMessage.Body = body;
            mMailMessage.IsBodyHtml = true;
            mMailMessage.Priority = MailPriority.Normal;

            // Instantiate a new instance of SmtpClient
            SmtpClient ss = new SmtpClient();
            //ss.EnableSsl = true;
            ss.Timeout = 10000;
            ss.DeliveryMethod = SmtpDeliveryMethod.Network;

            mMailMessage.BodyEncoding = UTF8Encoding.UTF8;
            mMailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            ss.Send(mMailMessage);
        }

2. Add the following smtp configuration in Web.config file.


 
 

Wednesday, March 16, 2011

My system is damn slow, what to do?

This post is an initiative for tips to improve the speed of system running Windows 7, so that we dont waste the system resources:

1. RacTask : Microsoft Reliability Analysis task to process system reliability data.
If you want to speed up your task rather than this analysis, diable this task in TaskScheduler.
Task Scheduler > Task Scheduler Library > Microsoft > Windows > RAC > RacTask > right click > disable

2.

Tuesday, February 1, 2011

Session state can only be used when enableSessionState is set to true

asp.net issue:
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that system.Web.SessionStateModule or a custom session statemodule is included in the \\ section in the application configuration.

One possible solution - Set the startup page in your website.

Sunday, January 30, 2011

Some Googling tricks

1. Go to www.google.com
Type "intitle:indes of" abc

abc can be replaced by anthing like: hack pdf OR abobe OR akon mp3

Now, browse the links in search result page and download if you find something interesting.


2. Go to www.google.com
Type inurl:"viewerframe?mode=refresh"


3. Go to www.google.com
Type intext:"UAA(MSB)" Lexmark-ext.pdf


4. Type elgoog

5. inurl:/view/index.shtml


spy the database sp changes

SELECT name, create_date, modify_date
FROM sys.objects

WHERE type = 'P'

order by modify_date desc

Tuesday, January 18, 2011

Find out, why the net is so slow?

  • Type cmd in your Windows Run box.
  • Type "netstat -b 5 > activity.txt" and press enter.
  • After say 2 minutes, press Ctrl+C.
  • Type "activity.txt" on the command line to open the log file in notepad

Sunday, November 28, 2010

Why WCF RIA Services?

1. To provide best user experience the client application should be aware of business logic at server-side, WCF RIA service solves this problem by providing framework components, tools, and services that make the server-side application logic available to the RIA client without requiring you to manually duplicate the business layer programming logic at presentation layer.
2. RIA Client application always gets latest business rules as it get compiled.
3. RIA Services adds tools to Visual Studio that enable linking Client project(Silverlight) and Server project(Asp.net) in a single solution and generating code for the Client project from the middle-tier code.
4. The framework components support prescriptive patterns for writing application logic so that it can be reused on the presentation tier.
5. Domain Service - In RIA Services, you expose data from the Server project to Client project by adding domain services. Here, each domain service gets implemented as WCF Service.