This was posted in
C#.NET on June 17th, 2009
Check for valid email using REGEX expression.
// check to see if it is a valid email
if( txtEmailAddress.Text != “Enter Email” && !Regex.IsMatch(txtEmailAddress.Text, @”^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$”) )
{
lvalEmail.Visible = true;
lidPage = false;
}
else
{
lvalEmail.Visible = false;
} |
This was posted in
C#.NET on June 17th, 2009
Generate two unique random numbers and returns them in an array.
private static int[] RandomNumbers()
{
int[] randomNumber = new int[2];
Random randomGenie = new Random();
for (int x = 0; x < 2; x++)
{
// makes sure that there are no duplicate numbers.
do
{
randomNumber[x] = randomGenie.Next(1, 5);
}
while (randomNumber[0] == randomNumber[1]);
}
return randomNumber;
} |
This was posted in
C#.NET on June 17th, 2009
When running multiple web applications, you may want to store settings in a global configuration file. To make things easier to read, configuration settings may be stored in application specific section blocks. In this tutorial, I will show you what to add to the web.config and how to use the settings in your web application. This is applicable to asp.net 1.1.
Read the rest of this entry »