ASP.NET

Archived Posts from this Category

Afternoon Tea - 11th June 2013 - Open Source Projects I Like: Glimpse

Posted by Chris Alcock on 11 Jun 2013 | Tagged as: .NET, ASP.NET, Afternoon Tea, C#, Community, Development, Morning Brew

A couple of weeks ago I watched the dotNetConf Open Source .NET Panel’ discussion which brought together a number of people from the .NET Open Source communities to discuss the state of Open Source in our community. The discussion was a good one, well worth watching and made me start to think about some of the Open Source projects I like – one of which features in this post.

Glimpse

Glimpse
Glimpse provides the answer for server side code that the likes of Firebug and Chrome Developer Tools provide for the client side developer. The project was originally conceived by Anthony van der Hoorn and Nik Molnar back in early 2011, and launched at Mix11’s Open Source Fest.

Glimpse did the usual Open Source project dance through many <1.0 releases, and mid last year became a project supported by Red Gate. Since then things have rapidly accelerated, and the community team have blasted beyond the 1.0 release threshold.

Today sees the announcement of Glimpse 1.4, along with a significant new look and feel introducing a Heads Up Display to make the most significant and useful information always available when Glimpse is enabled. Check out the announcement post over on the Glimpse Blog for the full lowdown, including a short video which gives a real impression of how the new Heads Up Display actually works.

More Heads Up

Get Your Head Up!

I love that adding Glimpse to a project while working is as simple as adding a NuGet package

Install-Package Glimpse.MVC4

Once installed, build and run your solution, and then hit up the Glimpse Handler to see what’s installed and to enable the tool

http://localhost:12345/glimpse.axd

So far all as expected. Now head back to your web application, and you will be greeted by the new look Heads Up Display at the bottom of the page, in all its Metro’esque glory.

Glimpse Heads Up Display

The Heads Up Display appears across the bottom of all pages when enabled, providing at a glance key metrics about the page:

  • Key Overall Timing Metrics
    • Overall Time
    • Time spent network communicating
    • Time Spent processing Server Side Code
    • Time until DOM Ready
  • Server Side Processing Breakdown
    • In the MVC case identifying the Controller
    • The Action processing time
    • The View processing time
    • The Time taken by Database queries triggered by the page
  • Realtime updating view of the Ajax Requests

Hovering the mouse over each of these sections gives further information about the metrics in a concise and clear, yet information dense way:
Heads Up Display Detail

More new UI awaits you on clicking the ‘g’ logo in the corner, the traditional way to summon Glimpse’s detailed FireBug like UI to the foreground, which has also had the Metro style make over. If you’ve ever used Glimpse before you will be familiar with the range of information available in here, including the very useful (and even prettier now) Timeline view:

Glimpse Detail View - Timeline

Why Glimpse Works for me

  1. Very, very easy to get up and running
    The ‘Pit Of Success’ is easy to get into, install the package, enable via a URL, and you are reaping the rewards.
  2. Tells me useful information
    Glimpse has the useful metrics, configuration and information readily available – other than enabling it there is nothing more that needs to be done
  3. Friendly and far reaching community
    Nik and Anthony are nice chaps and have fostered a good community round Glimpse, and care about engagement in the open source community. The community is growing with with ever increasing numbers of contributors and extensions for all kinds of things ranging from pure ADO to SignalR - I’ve found the SignalR one useful on a number of occasions
  4. Easy Extension
    It’s pretty simple to start adding your monitoring for your own functionality to a custom Glimpse tab (so easy I’ve managed it!)

I’ve found having the metrics Glimpse provides to be invaluable on a countless occasions, and I encourage you to try it out, or even better, get involved with the project itself.

Full Disclosure – Anthony & Nik gave me a preview of the new Head Up Display functionality a few days ago, which prompted me to tell you how much I’ve liked Glimpse for quite some time – No money exchanged hands, but I might let them buy me a drink when I finally get to meet them both ;)

The Morning Brew #1215

Posted by Chris Alcock on 22 Oct 2012 | Tagged as: .NET, ASP.NET, Development, Morning Brew

Software

Information

Community

  • Free Webcast - Getting Started with .NET Gadgeteer - Clare Morgan highlights a free webcast event presented by Simon Morgan which will take a look at getting started with the .NET Gadgeteer. The event takes place on Thursday 8th November 9pm UK, 4pm New York, etc.

The Morning Brew #1195

Posted by Chris Alcock on 24 Sep 2012 | Tagged as: .NET, ASP.NET, C#, COM Interop, Database, Development, Links, Morning Brew, SysAdmin

Software

  • jQuery 1.8.2 Released - The jQuery Team announce the release of jQuery 1.8.2, a bugfix and performance regression fix release. As usual the files are available from the jQuery site, and should be making their way to the various content delivery networks.
  • IE 9.0.10 Available via Windows Update - The Internet Explorer Team have released a high importance security patch for Internet Explorer 9 to address recently reported security issues. Additionally there is an update for Internet Explorer 10 to address a Adobe Flash issue.

Information

Afternoon Tea - Sunday 10th June 2012

Posted by Chris Alcock on 10 Jun 2012 | Tagged as: .NET, ASP.NET, Afternoon Tea, C#, COM Interop, Community, Database, Development, Links, Morning Brew, SysAdmin, Talks / Presentations

It’s been quite a while since the last ‘Afternoon Tea’ post, and there have been quite a lot of significant announcements in the past few weeks, coupled with my being busy at work which has resulted in me building up quite a backlog of links which I really wanted to include in a Morning Brew. This post is my attempt to ‘clear the decks’ and get caught up again, and also provides the perfect excuse to do a link roundup of DDD South West which I had the pleasure of presenting at at the end of last month.

Software

  • Introducing jQuery++ - Justin B Meyer and the folsk over at Bitovi announce the release of jQuery++, a collection of DOM helpers which complement and extend jQuery
  • Bundler.NET - Bundler.NET brings the CSS and JavaScript minification and combining features of .NET 4.5 to earlier versions of .NET. The installation is simple via a NuGet package and the API reflects the .NET 4.5 implementation.
  • bddify is moved to GitHub and is renamed to TestStack.BDDfy - Mehdi Khalili gives an update on TestStack.BDDfy, the project formerly known as bddify, discussing the name change, and change to the projects hosting, along with looking at the structure of the NuGet packages which amke up TestStack.BDDfy.
  • #mvvmlight V4 for Windows 8 RP is available - Laurent Bugnion announces the release of version 4 of his MVVMLight framework for Windows 8 Release Preview
  • Get latest CSS 3 support in Visual Studio 2010 - Mads Kristensen discusses how you can get the latest version of the CSS3 support into your Visual Studio 2010 installation providing a link to the schema files required and giving instructions on getting it setup and installed in Visual Studio 2010
  • Tree Surgeon - Alive and Kicking or Dead and Buried? - Bil Simser gives an update on an old tool that I used to make considerable use of in the past. Tree Surgeon was a tool to create a standardized format of Development Source Tree structure. In this post Bil discusses how the landscape of .NET development has changed in the 4 years since its last release with improvements in T4 Templating and NuGet, and questions if there is a future for the project.
  • Introducing RabbitBus - Derek Greer introduces RabbitBus, a .NET client API implementation for working with RabbitMQ, aiming to provide constructs which are not provided in the standard RabbitMQ .NET client. The library is open source with code available on GitHub, and the installation is available in NuGet package format.

Information

DeveloperDeveloperDeveloper South-West 4.0

The Morning Brew #990

Posted by Chris Alcock on 28 Nov 2011 | Tagged as: .NET, ASP.NET, COM Interop, Development, Morning Brew, Photography

Disaster struck this morning - I pressed post, waited until the page reloaded and shut my laptop as usual, but for reasons unexplained the post never made it onto the site - So here is today’s edition, a little later than planned - at least its still morning *somewhere* in the world!

Thanks to Libor or letting me know something was wrong

Update: In my haste to resurect today’s post a ’smart quote’ snook into some HTML merging Sankarsan & Jon Skeets links together - fixed now - thanks to EF for letting me know

Software

  • Simple.Data for Mono - Mark Rendle has got his Simple.Data Dynamic Data Access library up and running under Mono, with most of the tests passing. The Mono release is available as a tgz download from the project’s GitHub Site.

Information

  • New Bundling and Minification Support (ASP.NET 4.5 Series) - Scott Guthrie continues his series of posts looking at the new features of ASP.NET 4.5, currently available in the Developer Preview Release. In this post Scott discusses the new support for bundling and minification of CSS and JavaScript Resources.
  • Inside ASP.NET 4.5 Bundling and Minification - Sankarsan discusses some of the details behind the Bundling and minification, looking at how the functionality is implemented in the framework, discussing how the functionality is called and the interactions between the parts.
  • Eduasync part 17: unit testing - Jon Skeet continues his exploration of the Async / Await functionality of C#5 discussing how it is possible to unit test async code (sometimes), illustrating by showing and discussing some of the tests for his Majority Voting implementation.
  • Razor Donut Caching - Phil Haack discusses the possible look and feel for the re-introduction of donut caching in ASP.NET MVC4, highlighting a package available for MVC3 which adds the functionality and discussing some of the limitations and possible changes to Razor to make creating donut holes easy.
  • REPL for the Rosyln CTP 10/2011 - Chris Sells discusses the Roslyn CTP release and the Read Evaluate Print Loop (REPL) environment, looking into creating a console based REPL environment using Roslyn, showing how easy executing lines of code becomes with Roslyn.
  • Reflection, performance and runtime code generation - Ivan Towlson discusses the use of reflection and code generation with regard to the performance of code where you need to work with types you don’t know at compile time.
  • Building F# Solutions in Visual Studio 11 &
    Traffic Cop - Fresh Brewed Code, a new blogging community site for developers kicks off with posts from Dan Mohl highlighting resources for working with F# in Visual Studio 11, and Jim Cowart sharing an implementation he calls Traffic Cop for situations where he needed to avoid multiple jQuery Ajax requests for the same resources.
  • Method Stubs - Phil Trelford discusses Test Driven Development in F#, focusing particularly on how you don’t need frameworks to implement stubs and spies in F#.
  • 31 Days of Mango | Day #26: Background File Transfer , Day #27: Microphone API &amp Day #28: Media Library - Jeff Blankenburg’s series of posts on Windows Phone Mango continues with three more guest posts, first another from Gary Johnson discussing background file transfer. Next Parag Joshi discusses the Microphone API and the recording of audio, and finally Jeff Fansler takes a look at the Media Library.
  • 10 Laps around Silverlight 5 (Part 7 of 10) - Michael Crump continues his Silverlight 5 series with part 7 exploring operating system integration with a look at power awareness, 64 bit browser support and Save Dialogs.

Community

  • NxtGenUG - Santa Westley - Liam Westley joins the NxtGenUG in Coventry of their User Group meeting on Monday 12th December. There are no details of the session to be delivered, but Liam is an excelent speaker, and will nodoubt be brings some swat and probably some tasty treats too!

Relocating Temporary ASP.NET Files

Posted by Chris Alcock on 15 Oct 2007 | Tagged as: .NET, ASP.NET, Development, IIS, SysAdmin

When you first request a page from the an ASP.NET application, the .NET framework takes the ASPX file and generates code to actually execute the page. This code is then compiled by the framework and the results of the compilation are stored in the Temporary ASP.NET files directory within the framework directory (usually located in c:\windows\Microsoft.NET\Framework). When the ASPX of the compiled DLL changes this code is re-generated and recompiled.
On a server that hosts lots of ASP.NET applications this store of temporary compiled code can occupy a considerable amount of space. On machines with a limited amount of space on their OS partition this can begin to cause problems. Thankfully the ASP.NET framework does allow the location of this directory to be specified as a custom location.
As with most server wide settings you need to make a change to the Machine.Config (for .NET 1.1) or Machine wide web.Config (for .NET 2). The crucial part of the configuration is the Compilation element within system.web. The compilation element has an optional attribute called tempDirectory that allows a new directory location to be specified overriding the default setting of %FrameworkInstallLocation%\Temporary ASP.NET Files.

<system.web>

   <compilation tempDirectory="d:\TempASP.NETFiles\">

      ...

   </compilation>

</system.web>

One thing to watch out for when making this change is the file permissions on your new Temporary ASP.NET files - copying the permissions from the original location will do the trick nicely.

Invalid XML from a .NET web service

Posted by Chris Alcock on 01 Oct 2007 | Tagged as: .NET, ASP.NET, C#, Development, Web Services, XML

10187684_78f140f0e2_m.jpg
Image Credit: kevinzim on Flickr

One of my basic assumptions about the .NET framework was proved incorrect last week. Up until then, I had believed that when you are using the built in framework classes for exposing web services you were always safe when it came to the output being valid XML. Sadly that turns out to be untrue, and to make matters worse, .NET will happily output XML over a web service even its own .NET web service clients can’t read.

There are certain characters that are forbidden from being in XML as per the official specification. These characters are the low ascii characters such as NULL, EOF etc. Its important to note that this is not a case of unescaped/unencoded versions of this character being disallowed, the encoded characters are also disallowed.

The problem with this isn’t that the .NET framework doesn’t understand these rules - it manages just fine when it comes to acting as a client to a web service serving these characters in content, throwing nice exceptions explaining that these characters are invalid. Additionally, the XML Text Reader has a property ‘Normalization’ which causes the XML reader to be more liberal and ignore invalid characters - but this option is not used within the automatically generated Web Service Client.

This problem isn’t limited to just the web services, standard XML serialisation also experiences the same problems. Here are bits of code that illustrate the problem:

[WebMethod()]

public string InvalidCharacter()
{
   return "" + (char)4;
}

public class MyClass
{
   public string Test = "" + (char)0;
   public static void Main()
{
     MyClass c = new MyClass();
     System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(MyClass));
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     System.IO.StringWriter sw = new System.IO.StringWriter(sb);
     xs.Serialize(sw, c);
     Console.WriteLine(sb.ToString());
    
     System.IO.StringReader sr = new System.IO.StringReader(sb.ToString());
     try
     {
         c = (MyClass)xs.Deserialize(sr);
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex.ToString());
}
}
}

The little console application gives output like this:

<?xml version="1.0" encoding="utf-16"?>
<MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <Test>&#x0;</Test>
</MyClass>

System.InvalidOperationException: There is an error in XML document (3, 12).
System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character.
Line 3, position 12.

Unfortunately I haven’t yet found a fix for this - my only solution is to work around the problem by ensuring that these invalid characters can’t get into the system in the first place or clean the text on the get of each property of the serialized objects.

Things like this really worry me - our frameworks shouldn’t be outputting things that they can’t read - let alone outputting things that completely contravene the specifications. As always, any suggestions on an alternative solution to this problem are welcome.

The Evil ASP.NET Tab and other adventures with MMC

Posted by Chris Alcock on 27 Feb 2007 | Tagged as: .NET, ASP.NET, IIS, SysAdmin

Today I encountered a strange problem with IIS6 restarting without notice on a server that had recently had the .NET Framework 2.0 installed on it. In our particular case the problem was made worse by the fact that the IIS restart was unsuccessful leaving the server in a some what crippled state. We traced the problem to clicking on the ASP.NET in the IIS Management MMC, not making any changes to the settings, then clicking OK on the properties dialog.
Usually making a change to the version of ASP.NET will cause a restart of IIS (and there are alternative ways that avoid the restart), however in this case it seems as though just viewing the tab and then clicking OK was enough to cause ASP.NET to restart the IIS Service. I’ve still not discovered precisely why this is happening, but for the time being I wanted to implement a work around to avoid the problem by disabling the ASP.NET Tab.

I thought doing this would be easy, after all enough people seem to have problems with the tab not being there. Common causes of the tab being missing seem to be running the IIS MMC on x64, or having installed an earlier beta of .NET 2.0. The fixes in most cases seem to be modifications to the registry or re-running aspnet_regiis -i to re-register ASP.NET.

While it is possible that by fiddling with the registry I could break the ASP.NET tab that didn’t seem to be a good solution, so I carried on digging. It turns out that the ASP.NET Tab is implemented as an MMC Snap-in extension, and can be disabled with two clicks of the mouse once you’ve found the setting. So, to disable the ASP.NET tab within the ASP.NET management MMC:

  1. Start the MMC console (Start > Run > ‘mmc’ OK)
  2. Open the IIS management mmc (Console > Open > ‘%windir%\system32\inetsrv\iis.msc’ OK)
  3. Edit the Snapin Settings (Console > Add/Remove Snap-in)
  4. Choose the Extensions Tab, and disable the ‘ASP.NET Management Extension’ by unticking ‘Add all Extensions’ and the unticking the ‘ASP.NET Management Extension’.
  5. OK the changes and then save the console (Console > Save )

Now when you start the IIS Manager the ASP.NET tab won’t be there.

Sadly the tab is still there in the Computer Management MMC (Computer Management > Services And Applications > Internet Information Services), and looking at the computer management MMC in the same way as above does not yield the same choice of Extensions, so if anyone knows how to influence Computer Management in the same way, please let me know!