Wednesday, July 15, 2009

 

Creating a Test Application to Convert

1. Create a new Web Application in Visual Studio 2003
2. Go to the code behind for WebForm1
3. In WebForm1 Create a Public Static Method which returns a string.
4. Add a Class File
5. In the Class File Create a Public Static Method which returns a string.
6. In WebForm1_PageLoad call the ClassFile method and the WebForm1 Method
7. Create a new WebForm
8. Add a reference to the method in WebForm1 in to WebForm2
9. Add a new Folder
10. Add another Page in to there
11. Add a reference to the Method in WebForm1 into WebForm3

Converting the Application

12. Convert the Applications to 2005 Format

13. Look at the Conversion Wizard Report
a. Note Code Files being moved to the Code Folder

Moved file Global.asax.cs to the App_Code\ directory.
Moved file Class1.cs to the App_Code\ directory.
Moved file AssemblyInfo.cs to the App_Code\ directory.

14. Note how WebForm1 & WebForm2 run fine.
15. Note how WebForm3 doesn’t work at all
a. Show the code behind of this file and the lack of WebForm1 class being available.
16. Note how the project will not build with the erroneous entries.

Precompile the Web Site

17. Fix any errors so the site will “Rebuild All”.
18. Publish the Web Site using the publish tool.
19. Show the content of the Bin folder.
a. Note how WebForm1.aspx and WebForm2.aspx share the same filenames (just before the .dll) whereas WebForm3 has a different filename.

Version Switcher on Windows XP

1. Show two sites
2. Make warning Regarding Production Servers
3. Point out it can be done from the command line
 

function to test dates

private void TestDates()
{
DateTime dt = DateTime.Now;
string timeHHMMSS = dt.ToString("HHmmss");

Console.WriteLine(dt);
Console.WriteLine(int.Parse(timeHHMMSS));
Console.WriteLine(timeHHMMSS);
TimeSpan ts = dt.TimeOfDay;
Console.WriteLine(ts.ToString());
timeHHMMSS = dt.ToString("HHmm");
Console.WriteLine(timeHHMMSS);
}
 

function to test HHMM -- HoursMins using regular expression (REGEX)

private string TestHHMM()
{
string InputString = DateTime.Now.ToString("HHmm"); // "2200";
if (InputString.Length >= 2)
InputString = InputString.PadLeft(4, '0');
Regex RegexObj = new Regex("^([0-1]\\d|2[0-3])([0-5][0-9])$");
if (RegexObj.IsMatch(InputString))
Console.WriteLine("true");
else
Console.WriteLine("false");
return RegexObj.Replace(InputString, "$1:$2");
}
 

function to test date MonthYear from input string

private string TestDateMonthYear()
{
string InputString = "200819";
Regex RegexObj = new Regex("^(\\d{4})([0]?[1-9]|1[0-2])$");
return RegexObj.Replace(InputString, "$2/$1");
}

This page is powered by Blogger. Isn't yours?