By tag: Scenario
0
kicks
LINQ and Stored Procedures
Just starting off with LINQ, I've already found a strange behavior. In my SP, I have to select some blank columns, that used to exist in the table. Now, they're only there to stop old apps from crashing:
Select '' as inst from footable
This made Linq return only a cryptic error message:
Syste...
0
kicks
Using using
When writing code that makes use of alot of unmanaged memory resources, all objects should be disposed of before exiting methods and such. The keyword using is often forgotten, and also sometimes seen as messy. example:
using (Bitmap bitmap1 = new Bitmap(100, 100))
{
Console.WriteLine("Wid...
0
kicks
Session_End and SessionState mode="SQLServer"
A webapp I'm working on now needs to keep track of the number of logged in users at any time. We used to rely on Session_End for deleting sessions. However, this turned out to work only if the SessionState mode was set to InProc. For other scenarios, Session_End is simply not called. Ever.
So we...
0
kicks
Online MachineKey Generator
Found this today, when creating MachineKey for a web farm on ASP.NET:
http://www.orcsweb.com/articles/aspnetmachinekey.aspx
Will save you some time when creating webapps that run in a web farm environment, and it does work.
0
kicks
IIS and .net 3.5 beta 2
We installed .net 3.5 beta 2 on a web server this morning. It did not work. Even our 2.0 webs stopped working. So to save others the trouble...
Go ahead to
%WINDIR%\Microsoft.NET\Framework\v.2.0.something...\CONFIG\web.config
Go ahead and remove all instances of xmlns="" and you're go...
0
kicks
Remote desktop stops working
Suddenly my workstation wouldn't accept incoming remote desktop sessions. I first thought it was because I was connecting from a Vista computer, but as it turned out, I couldn't even connect from other 2003 servers. The event log only said this:
Application popup: : \SystemRoot\System32\RDPDD.dll...
0
kicks
SQL 2005 Server Side Paging using CTE (Common Table Expression)
When a application want to show the result from an SQL-query as a paged view, i.e. showing ten or fifteen result on first page, then have a "next" function to show the next page of results.
To minimize traffic over the network, it is best practice to do the paging on the SQL-server, so ...
0
kicks
Reflecting on reflection
Some weeks ago I was working on a project where we receive some ten or twenty different message types from a server, and they all need to be handled when they arrive. Of course, we want to use event driven programming to make this happen on the fly, instead of polling all the time.
All of the mes...
0
kicks
Where are my Properties.Settings saved
Have you ever wondered where your user settings are saved from an .NET application? You would probably think that it's saved in the [application].exe.config(located in your application folder) file, but this is only partially true. The default values you create in Visual Studio are saved in this fil...
0
kicks
Managing Unmanaged Resources
Unmanaged Resources are objects that are not garbage collected, which means that they are not reclaimed by the system when the garbage collector cleans up after you.
But are Unmanaged Resources resources outside .NET framework like DLL used through interop? No, unmanaged resources can also be dat...
0
kicks
Illegal Cross Thread Operation?
I see many forumposts solving this problem by simply adding the CheckForIllegalCrossThreadOperations=false;
While this is a totally legit workaround, it is highly thread-unsafe, and should only be used for debugging purposes. To be able to update for instance form-components from another thread, ...