Wednesday, November 17, 2010

Web.config customErrors element

In de web.config of a (web) application it is possible te configure the customErrors element. Mostly for development I want to see the details of the errors so I can fix these quickly. But when the application runs for end-users I want to be informed about these errors and the users sees a friendly message "there is something wrong, this is registrerd".

Monday, November 1, 2010

ildasm.exe

In the command prompt of Visual Studio it is possible to call the windows tool
ildasm.exe. With this tool the assembly manifest is readable and so the related assemblies can be retrieved.

Monday, October 18, 2010

Public token key

With the 'sn.exe' tool of Visual Studio it is possible to retrieve the public token key. But watch for the casing!!

Use the command: sn.exe -Tp "FilePath to assembly"

Tuesday, October 12, 2010

Fiddler and localhost

Working with Fiddler for seeing the details of the Http request of a website is usefull for optimizing the performance of a website. Check if there are unneeded requests or if there are many requests which triggers a 404.

A tip when working with localhost you must http://localhost.:1519/default.aspx instead of
http://localhost:1519/default.aspx. So add a point behind the hostname.

IEnumerable Empty

When creating an IEnumerables, I mostly returned a null value when there are no values for the collection. But it is in some situations better to return an empty collection. This can be done with the Enumerable.Empty method.

Wednesday, May 19, 2010

How to take ScreenShot in C#

From this article I have copied the code below for taking a screenshot. I have not yet tested this code, because I do not reminder where I need this... when I do I will update this post:)

here is the code in C# for screenshot.

int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);