Validate a GUID in C#

May 31, 2006
I recently needed to validate a GUID in C# and found this article on how to do it. I've simplified it to make it suit the problem I was trying to solve. Here's what I did with it: private static Regex isGuid = new Regex(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled); private static bool IsGuid(string candidate) {    if (candidate != null)   &nb... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Web statistic applications do not agree

May 22, 2006
Working in the web marketing statistics business, I know how difficult it is to produce reliable statistics about visitors and their actions. A good web stat application, whether it is behavioral or marketing related, has to make good decisions all the time to produce correct, uniform, and reliable statistics. It takes constant monitoring and adjustments and also has to be build with intelligence for self maintenance. It also has to make decisions about fraud and various brow... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

What makes a good programming book?

May 21, 2006
During the last couple of years, I’ve been reading quite a few books about various programming topics and related technologies. Some of them take a very practical approach with a lot of examples and some take a more philosophical approach and some books are somewhere in between. Examples of the practical books are Microsoft ADO.NET Core Reference by David Sceppa and Visual Basic .NET Unleashed by Paul Kimmel. They are filled with code samples and how-to guides and... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Use If-Modified-Since header in ASP.NET

May 20, 2006
If you are building a high traffic website, you are probably concerned about bandwidth. Many hosting centres charge based on the amount of bandwidth you use, and it can be rather expensive for high traffic sites. This is where the If-Modified-Since header comes to the rescue. By utilizing this request header, you can do what is normally referred to as a Conditional Get. This basically means that the server only has to serve content if the browser hasn’t already c... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Extending the Test Browser

May 18, 2006
In my efforts to improve the web developer's Test Browser, I have now added 3 new feature. Cookie watcher (the name and value) Link list window (the URL, title- and accesskey tag) Image list window (the URL and alt tag) The point of these features is to give you a better understanding of what's going on at the web page you're analyzing. I already found several issues about some of my websites with these new features, because ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Testing the size of the viewstate in ASP.NET

May 17, 2006
When you are developing an ASP.NET web form, you want to make sure that the viewstate isn't larger than it has to be. The more viewstate you've got, the longer the page takes to render in the browser. I have often seen gigantic viewstates, larger than 50 kb in size. For obvious reasons, this is not desirable if it can be avoided without breaking any functionality. To test the size of the viewstate, just view the source code and count the lines of the hidden input fie... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

A web developer’s browser

May 16, 2006
As a web developer, I do a lot of testing against different browsers and validating to W3C standards. These are the two things I spend most time doing when testing the HTML interface. It has become a common thing to do by most web developers no matter what kind of website they create and what tools they use. The way most of us do it is by having a lot of different browsers open at the same time and the W3C HTML validation service web site. This approach is pretty goo... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Bind fonts to a dropdownlist in C#

May 14, 2006
I recently had to make a dropdownlist populated with fonts. Luckily, .NET allows you to use the installed fonts very easy. First, add a drowdownlist to your ASP.NET page like this: <asp:DropDownList runat="Server" id="ddlFonts" /> Then call this method to do the actual databinding of the fonts: private void BindFonts() {    System.Drawing.Text.InstalledFontCollection col = new System.Drawing.Text.InstalledFontCollection();... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Remove whitespace safely at runtime

May 9, 2006
A couple a months ago, I wrote how to remove whitespace from an ASP.NET page. However, the whitespace removal was to extreme for most websites. It mangled with the HTML to such an extent that only very simple websites could use it without damaging their code. I’ve just finished a more complex website and therefore had to make some changes to my original whitespace removal method. Otherwise, the JavaScript wouldn’t work including the postbacks. To make it work,... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Cache dynamic generated images in ASP.NET

May 8, 2006
I you have an image gallery with dynamically generated thumbnails; you should make sure that the browser is told to cache the thumbnails. If not, each image is generated every time the browser visits. It stresses the CPU unnecessary and the page takes longer to load. If the images where in the browsers cache, the page would load much faster and the images would not be generated on each page request. If the image gallery consists of multiple pages the visitor can navigate ... [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.