Cybercrux

Everything is achievable through technology

C#

Tips & Tricks

1. Email Regx Validation

string pattern = null;
pattern = “^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$”;

if (Regex.IsMatch(“feedback@net-informations.com”, pattern))
{
MessageBox.Show (“Valid Email address “);
}
else
{
MessageBox.Show(“Not a valid Email address “);
}

One thought on “C#

  1. // Get the directory info for the existing folder
    DirectoryInfo dirInfo = new DirectoryInfo(settingsFileDir);

    // Now apply user access permissions to the folder
    if (dirInfo != null)
    {
    DirectorySecurity security = dirInfo.GetAccessControl();
    security.AddAccessRule(new FileSystemAccessRule(“Everyone”, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
    security.AddAccessRule(new FileSystemAccessRule(“Everyone”, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
    dirInfo.SetAccessControl(security);
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s