Top ASP.NET Items

Sponsors

Archives

Browse by Tags

All Tags » ASP.NET (RSS)
Announcing the Release of WebMatrix 3
I’m excited to announce the release of WebMatrix 3.  WebMatrix is a free, lightweight web development tool we first introduced in 2010 , and which provides a great, focused web development experience for ASP.NET, PHP, and Node.js.   Today’s release includes a ton of great new features.  You can easily get started by downloading it, and watching an introduction video: Some of the highlights of today’s release include deep Windows Azure integration, source control tooling for Git and TFS, and a new remote editing experience.  Windows Azure Integration With WebMatrix 3, we are making it really easy to move to the cloud.  The first time you launch WebMatrix 3, there’s an option to sign into Windows Azure.  You...
ASP.NET Web API: CORS support and Attribute Based Routing Improvements
We’ve seen a huge adoption of ASP.NET Web API since its initial release.  In February we shipped the ASP.NET and Web Tools 2012.2 Update – which added a number of additional enhancements to both Web API and the other components of ASP.NET.  The ASP.NET Team has been hard at work on developing the next set of features (lots of cool stuff coming).  One of the great things about this work has been how the team has used the open source development process – which we announced we were adopting last spring - to collaborate even more closely with the community to both validate the features early, as well as enable developers in the community to directly contribute to the development of them. Below are some updates on two of the great...
Testing Orchard drivers
If you’ve ever tried to test Orchard part drivers, you may have been blocked by the fact that the methods on drivers are protected. That, fortunately, doesn’t mean they are untestable. Those methods are still accessible through explicit interface implementations. In particular, drivers implement IContentPartDriver, which is defined as follows. public interface IContentPartDriver : IDependency { DriverResult BuildDisplay(BuildDisplayContext context); DriverResult BuildEditor(BuildEditorContext context); DriverResult UpdateEditor(UpdateEditorContext context); void Importing(ImportContentContext context); void Imported(ImportContentContext context); void Exporting(ExportContentContext context); void Exported(ExportContentContext context); IEnumerable<ContentPartInfo>...
A C# helper to read and write XML from and to objects
I really like jQuery’s pattern of attribute getters and setters. They are fluent and work really well with HTML and XML DOMs. If you specify a value in addition to the name, it’s setting, otherwise it’s getting. In C#, we have an OK API for XML, XElement, but it’s not as easy to use as jQuery’s attr methods. It is also missing the flexibility of Javascript with regards to parameter types. To recreate the simplicity of attr in C#, I built a set of extension methods for the most common simple types: var el = new XElement("node"); el.Attr("foo", "bar") .Attr("baz", 42) .Attr("really", true); var answer = el.Attr("baz"); The element built by this code looks like this: <node foo="bar"...
Logging SQL queries in Orchard
It is often useful to see what database queries were made during a specific request in Orchard. There are quite a few ways to do this (you can trace right from SQL Server , or you can use Mini-Profiler for instance), but this morning Sébastien showed me a really easy one that I thought I’d share. Find the log4net.config file in /src/Orchard.Web/Config and edit it to add the following tag: <logger name="NHibernate.SQL"> <priority value="DEBUG" /> </logger> Restart the application, then hit the URL you want to test, and look at your logs in App_data/logs. You should see new entries looking like this: 2013-04-03 18:57:30,367 [17] NHibernate.SQL - SELECT warmupsett0_.Id as Id575_0_, warmupsett0_.Urls as Urls575_0_...
This is how we should read hexadecimal…
Today my five-year-old told me that when she was four, she thought that what came after ninety-nine was… tenty. You know, because seventy, eighty, ninety, tenty. At first I thought it was just funny and charming, but then I realized it was actually a really good idea. Tenty is only nonsensical if you’re counting in base ten (or lower), but it makes total sense for higher bases. How do people usually read 0xA0? “A-zero”? How unimaginative! Let’s read that “tenty” from now on! Here are some more examples of how to read hexadecimal in a non-boring way: 0xB3 is eleventy-three 0xCA is twelvety-ten 0xD9 is thirteenty-nine 0xEC is fourteenty-twelve 0xFF is fifteenty-fifteen 0xF04A is fifteenty hexathousand and forty-ten 0x4B2AC0AA is forty-eleven hexamillion...
Taking an Orchard site offline while you update it
If your hosted environment does not give you a staging site and the means to swap it easily with the production environment like Azure Cloud Services do, or if you don’t have a staging database, or if you just need to take your site offline for the public while you perform data updates in the admin, you may be wondering what solutions you have, if any. IIS has an app_offline.htm feature that you can use, that will serve a static page for all requests but that’s rather brutal as it does not just take the site offline for your users, it also does so for you. While that file exists, you can do absolutely nothing with your site. You cannot access the admin, you cannot preview your changes, nothing. So when you flip the switch back, it’s anyone’s...
Always have a host or URL prefix on the default Orchard tenant
The multi-tenancy feature in Orchard enables you to host multiple sites within the same Orchard instance. It’s not a a security feature, just a way to improve site density, and to enable you to save on hosting costs. Nevertheless, a request to a specific existing tenant should never be answered with a page from another tenant. Ever. There is however a fallback mechanism that enables one tenant to handle all requests that weren’t identified by another tenant. While this could be considered useful in some scenarios, I’m hereby declaring it bad practice. If for any reason a tenant fails to start, for example, requests to that tenant are going to fall back. Even if you were in a scenario where you considered fallback to be useful, this is an unexpected...
Announcing release of ASP.NET and Web Tools 2012.2 Update
I’m excited to announce the final release of the ASP.NET and Web Tools 2012.2 update .  This update is a free download for Visual Studio 2012 and .NET 4.5, and adds some great additional features to both ASP.NET and Visual Studio. Today’s update makes no changes to the existing ASP.NET runtime, and so it is fully compatible with your existing projects and development environment. Whether you use Web Forms, MVC, Web API, or any other ASP.NET technology, there is something in this update for you.  Click here to download and install it today! This ASP.NET and Web Tools update will also be included with the upcoming Visual Studio 2012 Update 2 (aka VS2012.2). Visual Studio Web Tooling Enhancements With today’s release, all of the ASP.NET...
Easy content templates for Orchard, take 2
Placement.info is an XML file that orchestrates the different parts of a content item and sends each of the shapes they create into specific local content zones. If the previous sentence sounded confusing to you, fear not, this post is for you. When writing an Orchard theme, more often than not, you know exactly what parts exist in your content type, and you know where you want them to render. Placement can be extremely powerful, but it’s rather abstract and it reverses the usual logic of placing contents on a page. What most people really want to do is write a template with simple markup and placeholders inside that markup for the rendering of specific parts such as title, summary, tags, etc. Placement forces you to dispatch those part shapes...
More Posts Next page »