About
Digital Colony is the technical web site for Michael Allen Smith of Seattle.
Category Archives: C#
Adding a Stylesheet to a Master Page in C#
I just updated the code for the Row and Column Highlight for Gridview Control lab. I decided to put the CSS specific to that feature in its own style sheet. Since I am using Master Pages for the labs, I … Continue reading
Validate Web Page Against W3C Validator in .NET
During one of the redesigns of DeepFitness.com, I decided to make sure all the articles validated to XHTML. The post Converting HTML to XHTML Programmatically in .NET shows how I did that. FreeTextBox did an excellent job assisting with the … Continue reading
Return HTML Page Source From Web URL in C#
Below is a snippet of code showing how to retrieve the page source of a web page. This code will return the HTML source from the home page on this site. It will then load that HTML into the string … Continue reading
Single Line If Statement in C#
Here is a standard if … then statement in C# followed by a single line example. Using a single line if statement will reduce the number of lines of code. if (dayOfTheWeek == “Tuesday”) { lunchLocation = “Fuddruckers”; } else … Continue reading
Sending Email in ASP.NET 2.0 (C#)
Here is the C# version of Sending Email in ASP.NET 2.0 (VB.NET). using System.Net.Mail; The code snippet demonstrates Larry King emailing Oprah. MailMessage Message = new MailMessage(); SmtpClient Smtp = new SmtpClient(); // Build message Message.From = new MailAddress(“larryking@cnn.com”, “Larry … Continue reading
