Total Pageviews

Tuesday, 29 November 2011

Step by step of ASP.NET membership


Step by step of ASP.NET membership
1.       Run aspnet_regsql.exe which located in C:\Windows\Microsoft.NET\Framework64\v4.0.30319.  This wizard gets connection info and creates some database tables, views, SPs with prefix ‘aspnet_’.
2.       Set in your web.config the following lines
   <connectionStrings>
    <add name="USRDBConnectionString" connectionString="Data Source=172.168.10.40;Initial Catalog=TvLibrary;User ID=sa;Password=sa1234;Max Pool Size=75;Min Pool Size=5;" providerName="System.Data.SqlClient"/>
  </connectionStrings>

<membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="USRDBConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
 </membership>

<profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="USRDBConnectionString" applicationName="/"/>
      </providers>
</profile>

<roleManager>
      <providers>
        <clear />
        <add connectionStringName="USRDBConnectionString" applicationName="/"
          name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
        <add applicationName="/" name="AspNetWindowsTokenRoleProvider"
          type="System.Web.Security.WindowsTokenRoleProvider" />
      </providers>
</roleManager>

3.       Then go menu Website->ASP.NET configuration


How to NOKIA QT



  • 1.       Download Nokia QT SDK for windows  from

  • 2.       Setup it  following the steps described at

  • 3.       Create and run a project following the steps described at
        or

How to eMail using c#


using System;
using System.Net.Mail;

namespace Tools
{
    public class eMail
    {
        public class SMTP
        {
            private string _userName = "";
            private string _password = "";
            private string _smtpserver = "";

            private string _from = "";
            private string _subject = "";
            private string _body = "";

            MailMessage _smtp_mail = new MailMessage();

            public string SMTPServer
            {
                set { _smtpserver = value.Trim(); }
            }

            public string From
            {
                set { _from = value.Trim(); }
            }

            public string Body
            {
                set { _body = value.Trim(); }
            }

            public string Subject
            {
                set { _subject = value.Trim(); }
            }

            public SMTP()
            {
                this._userName = "";
                this._password = "";
                this._smtpserver = "localhost";
            }

            public SMTP(string user, string pass, string smtp_server)
            {
                this._userName = user;
                this._password = pass;
                this._smtpserver = smtp_server;
                MailMessage _mail = new MailMessage();
            }

            public void Credentials(string user, string pass)
            {
                this._userName = user;
                this._password = pass;
            }

            public void AddToRecipient(string recipient)
            {
                _smtp_mail.To.Add(new MailAddress(recipient));
            }

            public void AddBccRecipient(string recipient)
            {
                _smtp_mail.Bcc.Add(new MailAddress(recipient));
            }

            public void AddCcRecipient(string recipient)
            {
                _smtp_mail.CC.Add(new MailAddress(recipient));
            }

            public void Send()
            {
                _send();
            }

            public void Send(string From, string To, string Subject, string Body)
            {
                _smtp_mail.To.Add(new MailAddress(To));
                this._from = From;
                this._subject = Subject;
                this._body = Body;

                _send();
            }

            private void _send()
            {
                //set the addresses
                _smtp_mail.From = new MailAddress(this._from);

                //set the content
                _smtp_mail.Subject = this._subject;
                _smtp_mail.Body = this._body;

                //send the message
                SmtpClient smtp = new SmtpClient(this._smtpserver);

                if (!(_userName.Trim() == "" && _password.Trim() == ""))
                {
                    smtp.Credentials = new System.Net.NetworkCredential(_userName, _password);
                }

                try
                {
                    smtp.Send(_smtp_mail);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }
    }
}