madskristensen

Stories submitted by madskristensen

Serialization helper class in C# 2.0(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

C# 2.0 helper class that uses generics to deserialize the serialized data stream back to its original state. The example only works in C# 2.0. read more...

add a comment |category: |Views: 133

tags: another

Visual Basic functions in C# 2.0(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

If you used to be a VB developer, but for some reason are writing C# now, you probably miss a couple of functions. I remember being a little frustrated when I did the conversion from VB.NET to C#. It was March 2005 and I made the shift on the .NET 2.0 beta platform. I couldn’t understand why C# didn’t have some of the simplest functions like IsNumeric() and IsDate(). Also Left(), Right() and Middle() were missing. You could add a reference to the Microsoft.VisualBasic namespace, but that seemed like overkill for a few simple methods. read more...

add a comment |category: |Views: 1

tags: another

Remove whitespace from your ASP.NET page(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

In a normal webpage there is a lot of whitespace. We put it there in form of tabs and carriage-returns in order to make the document more maintainable and easier to read. But it has its price in terms of adding to the overall weight of the document in kilobytes and it takes longer for the browser to render a page with a lot of whitespace. This is especially true for IE6, which renders whitespace a lot slower than its counterparts. read more...

2 comments |category: |Views: 122

tags: another

The forgotten performance optimization tricks for ASP.NET(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

There are a lot of articles explaining the basics in performance optimization in ASP.NET. It is important to know the basics and use them where appropriate. The basics include caching, viewstate optimization etc. But what do you do to optimize further, when you have implemented all the basic techniques? You search the Internet to find an article about it, just like this one... read more...

add a comment |category: |Views: 5

tags: another

Generate random password in C#(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

Sometimes you need to create an auto generated password in your code. This method creates such a password and you decide the length and what characters are allowed. read more...

add a comment |category: |Views: 115

tags: another

Fix the Firefox cache problem(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

For some strange reason, Firefox caches ASP.NET pages even if you tell it not to. This could create problems with the back-button. Normally you can tell the browser how to cache your web page in two ways. You can use meta tags or set some HTTP headers. To be absolutely sure that all browsers understand you cache policy, you could combine the two. However, when you don’t want the browser to cache your page, Firefox caches it anyway. It does so because it cannot se any difference between how the page looked before and after you pressed the back-button. This issue drove me absolutely nuts today, and it took me a while to come up with a solution. read more...

add a comment |category: |Views: 31

tags: another

Store your settings in isolated storage(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

This is a good place to store small files like a setting or configuration file, because you have write permission by default. I have created a simple example of a static setting class called SesttingStore that has two properties which it persists to Isolated Storage. read more...

add a comment |category: |Views: 20

tags: another

Health monitoring in ASP.NET 2.0(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

The new ASP.NET 2.0 provider model, gives us the ability to tap into the event model and react to certain events. This article describes how to do simple error reporting by only editing the web.config. read more...

add a comment |category: |Views: 4

tags: another

Use If-Modified-Since header in ASP.NET(madskristensen.dk)

submitted by madskristensenmadskristensen(8565) 6 years ago

By tapping into the If-Modified-Since request header, you can optimize the load time for the visitor as well as save a lot of bandwidth. Perfect for RSS feeds. read more...

add a comment |category: |Views: 14

tags: another