Installing IIS 5.1 (for Win XP) and enabling .aspx pages

Windows XP can only accept IIS 5.1, but IIS 5.1 does not accept by default .aspx pages. This is because .aspx pages were introduced with the Framework 2.0 while IIS 5.1 predates this framework.

Installing IIS 5.1 on Windows XP:

1. Go to Control Panel
2. Open Add/Remove Programs
3. Select the Add/Remove Windows Components Tab
4. Select Internet Information Services (IIS) from the list
5. Click Next and follow the wizard

Once the installation is complete you can open your web browser and navigate to http://localhost/. IF IIS was installed correctly you should see its homepage. You will notice on the IIS homepage the page formats that it supports, but .aspx pages will not be present. To enable these pages on IIS you will need to have at least .NET Framework 2.0 installed.

Enabling .aspx pages on ISS 5.1:

1. Navigate to C:\Windows\Microsoft .NET\Framework
2. Enter the framework directory (v4.0.30319 for .NET 4.0 as example)
3. Search for a file named aspnet_regiis.exe
4. Run this program with the “ -i” command line parameter

You should see how IIS is reconfigured to use the latest framework. Now that everything should is set up, all you’ll have to do is to copy the website in the C:\Inetpub\wwwroot directory. On the local machine you can run the website by navigating to http://localhost/ or from any computer on the intranet by accessing your machine’s IP.

NOTE that IIS 5.1 can host only one site.

WPF - how to add text in a richtextbox

You mighyt have noticed that the RichTextBox control in WPF does not have a Text or Content method. so you will have to use something a little bit different. This method is usefull when you use a read only richtextbox and you want formated text in it.

First you'll have to initialize a paragraph, then add the string inside the paragraph and lastly add the paragraph to the richtextbox.

In the bellow example I will show you how to add a specific text in a richtextbox when a button is clicked.

private void btnAddText_Click(object sender, RoutedEventArgs e)
        {
//we want to clear all text inside the richtextbox, or else each time we click the button the same text will be added over and over again

            txtRichTextBox.Document.Blocks.Clear(); 

//We initialize 3 paragraphs

            Paragraph textTitle = new Paragraph();
            Paragraph textSubTitle = new Paragraph();
            Paragraph textDescription = new Paragraph();

//We will add the strings to the paragraphs as well as bolding the first and justifying the 3rd

            textTitle.Inlines.Add("This is a bolded title");
            textTitle.FontWeight = FontWeights.Bold;
            textSubTitle.Inlines.Add("This is a subtitle");
            textDescription.Inlines.Add("This is a long text so in case you'll copy paste this code you will notice how the text is justified. Just remember not to make the richtextbox too big.");
            textDescription.TextAlignment = TextAlignment.Justify;

//And here we add all 3 paragraphs to the rich text box

            txtRichTextBox.Document.Blocks.Add(textTitle);
            txtRichTextBox.Document.Blocks.Add(textSubTitle);
            txtRichTextBox.Document.Blocks.Add(textDescription);        
}