ASP.NET Runtime Cheat Sheet

This weekend I created an ASP.NET Runtime Cheat Sheet to be used as a quick reference for HttpRequest, HttpRuntime and AppDomain/Process/Identity stuff.

It shows several members of those classes, each with its live value from my site, a link to MSDN, and some explanations. I included links to useful tools (like Process Monitor) and good posts (like anything K. Scott Allen writes). The idea is to be brief and have the highest possible information-per-word ratio.

I wrote all of the information retrieval code as a user control, so it is easy to embed into an application for debugging. The code is in AspNetRuntimeDiagnostics.ascx, MIT-licensed as usual. The output should be restricted to trusted users though, since it’s a lot of information to potential attackers.

I hope this is useful to others. There are a couple of bits that could use more description, which I plan to add. The cheat sheet is a live document, your suggestions and corrections are very welcome.

Comments

8 Responses to “ASP.NET Runtime Cheat Sheet”

  1. John on February 24th, 2008 4:19 pm

    I’m trying to run your control and I get the following error: CS0246: The type or namespace name ‘Func’ could not be found (are you missing a using directive or an assembly reference?) I have .Net 3.5 installed on Windows XP (IIS 5.1 – it disturbs me that you can only tell IIS to use .NET 2.0). I can tell from the detailed compiler output that the V3.5 compiler is being used (see below). Thank you for writing an excellent and useful control. John Show Detailed Compiler Output: C:WINDOWSsystem32> "C:WINDOWSMicrosoft.NETFrameworkv3.5csc.exe" /t:library /utf8output /R:"C:WINDOWSassemblyGAC_MSILSystem.WorkflowServices3.5.0.0__31bf3856ad364e35System.WorkflowServices.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.Drawing2.0.0.0__b03f5f7f11d50a3aSystem.Drawing.dll" /R:"C:WINDOWSassemblyGAC_32System.EnterpriseServices2.0.0.0__b03f5f7f11d50a3aSystem.EnterpriseServices.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.Runtime.Serialization3.0.0.0__b77a5c561934e089System.Runtime.Serialization.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.ServiceModel.Web3.5.0.0__31bf3856ad364e35System.ServiceModel.Web.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.IdentityModel3.0.0.0__b77a5c561934e089System.IdentityModel.dll" /R:"C:WINDOWSMicrosoft.NETFrameworkv2.0.50727mscorlib.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.Configuration2.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.Web.Mobile2.0.0.0__b03f5f7f11d50a3aSystem.Web.Mobile.dll" /R:"C:WINDOWSassemblyGAC_32System.Web2.0.0.0__b03f5f7f11d50a3aSystem.Web.dll" /R:"C:WINDOWSassemblyGAC_32System.Data2.0.0.0__b77a5c561934e089System.Data.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.ServiceModel3.0.0.0__b77a5c561934e089System.ServiceModel.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.Xml2.0.0.0__b77a5c561934e089System.Xml.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem.Web.Services2.0.0.0__b03f5f7f11d50a3aSystem.Web.Services.dll" /R:"C:WINDOWSassemblyGAC_MSILSystem2.0.0.0__b77a5c561934e089System.dll" /out:"C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
    oot26676eb792c7e946App_Web_cwnvjcje.dll" /debug- /optimize+ /win32res:"C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
    oot26676eb792c7e946cwnvjcje.res" /w:4 /nowarn:1659;1699;1701 /warnaserror- "C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
    oot26676eb792c7e946App_Web_cwnvjcje.0.cs" "C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
    oot26676eb792c7e946App_Web_cwnvjcje.1.cs" Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8 for Microsoft (R) .NET Framework version 3.5 Copyright (C) Microsoft Corporation. All rights reserved. c:InetpubwwwrootAspNetRuntimeDiagnostics.ascx(23,34): error CS0246: The type or namespace name ‘Func’ could not be found (are you missing a using directive or an assembly reference?)

  2. Gustavo Duarte on February 26th, 2008 1:11 pm

    Hi John, Sorry about the problem in the source and thanks for pointing it out. There are two ways to fix it. You can add: <%@ Import namespace="System"%> Or for people not on .NET 3.5 (not your case), you can add: public delegate TResult Func<T,TResult>(T a1); I’m in the process of getting a new server up and running (should arrive this Friday). When that happens I’ll fix the source as my build server is currently down. cheers

  3. John on February 27th, 2008 11:16 am

    Adding the delegate for Func worked! I must not have .NET 3.5 setup correctly or its an issue running 3.5 on XP. I can see from the results of running the control on your server that you are on Windows Server 2003. Thank you for your help … Generics and Lambda functions are new to me and I need to study some more on the topic. I have a feeling that your control is a good example of how to best use them. Thank you again, John

  4. John on March 1st, 2008 12:45 pm

    I was able to remove the delegate statement for Func and got the import of the System namespace to work by adding the following to my web.config file: <system.web> <compilation> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> </system.web> I got this information from the following posting: http://forums.asp.net/t/1186042.aspx I’m not using Visual Studio 2008 which I assume would have done all this for me automatically. It’s interesting that I can’t find a file named "system.core.dll" in any folder under "windowsMicrosoft.NET". Thank you, John

  5. heatfan.wordpress.com on March 4th, 2008 2:54 pm

    Pingback from heatfan.wordpress.com How to manually add .NET 3.5 assemblies to web.config to take advantage of 3.5 features « Diary of a Miami Heat Fan

  6. Kyle on July 14th, 2008 12:02 pm

    Awesome – just wanted to say thanks – this is an incredibly valuable post :)

  7. Gustavo Duarte on July 15th, 2008 12:37 am

    Thanks Kyle – you’re very welcome.

  8. Jay on July 30th, 2008 11:40 am

    ASP.NET Runtime Cheat Sheet is awesome! Thanks!

Leave a Reply