Getting Debug Output From Scripts on ASPX Pages

To get some useful output when debugging C# or VB scripts on aspx
pages use the following statement in the script:

System.Diagnostics.Debug.WriteLine("We are here!");

In Visual Studio, attach the debugger to the process serving the
page containing the script (typically an IIS server process).
The debug text, “We are here!”, now appears in the output window
whenever the aforementioned statement in the script is executed!

Lazy Linking

Imagine that you have accumulated a database of customers, businesess or some other kind of organisation (from here on: “entries”).
For each entry you have properties such as name, address and telephone number, but you are missing one essential thing: The URL for the homepage of the entry.
You could fix this the hard way and begin looking up the homepage for every single entry, but this quickly becomes time consuming (and extremely boring).

If the correctness of the link to the homepage is not mission critical, there is another, easier you could try: Google’s “I Feel Lucky” feature.

Chances are, that the names of the entries are pretty unique. This means that a Google search on the name will most likely render the homepage for the entry at the top of the search results. This also means, that had you pressed the “I Feel Lucky” button, you would have been taken directly to this homepage. The good news is that you are not restricted to using this feature by clicking the actual button on Google.com. It is also possible to use it programatically by constructing a simple query string for the Google server.

For example: The following link will take you to the homepage of the CodeIgniter framework:

http://www.google.com/search?q=CodeIgniter&btnI=3564

the btnI=3564& means that we want to use the “I Feel Lucky” feature and the string after q= is our search string, i.e. the name of our entry.

The obvious drawback of the Lazy Linking method is, that it is inherently inaccurate. There are two scenarios, where it will fail:

1: If the homepage of the entry in question is not ranked at the very top of the search results.
2: If the entry does not have a homepage at all, the user will be taken to a random page.

However, if these drawbacks can be accepted, the method is definitely a time saver.

Too Many Connections to Terminal Server

If enough remote desktop users end their sessions by just closing the window instead of clicking Log Off you can run into the following error:


The terminal server has exceeded the maximum number of allowed connections

Here is how you can resolve the situation by ending the hanging connections.

Type the following in a dos prompt:

mstsc /v:<ip to remote machine> /admin

Once logged in, go to Start -> All Programs -> Administrative Tools -> Terminal Services Manager

Now on click on the name of the remote machine in the left panel and the logged in users will be shown in the right panel.

Right-click on each one and click Reset.