BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

Browse by Tags

All Tags » Tips and Tricks » Visual Studio » Atlas   (RSS)

  • July 4th Links: ASP.NET, ASP.NET AJAX, Visual Studio, Silverlight and IIS7

    I've fallen behind on my weekly link-listing series - apologies for the delay.

    ASP.NET

    • ASP.NET RSSToolkit 2.0 Released: One of the cool projects for ASP.NET 2.0 that was released last year was this free RSS Toolkit - which makes consuming and exposing RSS feeds in ASP.NET super easy (you can even databind any ASP.NET control against them).  The team working on the CodePlex project has recently released V2 of the RSSToolkit.  You can learn all about it and download it here.

    • Building a Custom Database Driven Site Map Provider: Scott Mitchell has written a great article on how to implement your own site map provider for ASP.NET that is populated from a database (instead of statically from an XML file).  You can learn more about the ASP.NET 2.0 SiteMap system from this older blog post of mine here.

    • .NET DateTime and Number Format String Cheat Sheet: If you are like me, you might have trouble remembering all of the standard format strings you can pass to the String.Format() method and/or the Eval() databinding method in ASP.NET to generate the appropriate string output from a DateTime or Numeric datatype.  This PDF cheatsheet is a useful one to download and save to quickly look these format strings up.  John has some other really useful .NET PDF cheatsheets he has also created that you might like to download here.

    • Profile Support for ASP.NET Web Application Projects: VS 2005 Web Application Projects can't directly access the strongly-typed ASP.NET "Profile" object that web site projects support.  This VS add-in supports the ability to generate a strongly typed profile class to accomplish this.  You can read this great series of posts to learn more about how to use the ASP.NET 2.0 Profile system.  I have it on my list of tips/tricks posts to-do to cover using this VS add-on as well.

    • ASP.NET Photo Handler: Bertrand has posted a cool photo album HttpHandler for ASP.NET that allows you to easily drop images into a web directory and automatically generate a nice photo album of them (complete with EXIF information, stack sorting icons, etc).  Might be very useful for people enjoying holidays this summer.  Download the code here.

    • BlogEngine.NET: This is a new open source blog engine for ASP.NET that Mads Kristensen has helped start up, and which I've heard a lot of good things about.  You can read about its features here, and download it here.

    ASP.NET AJAX

    • ScriptDoc 1.0 Available: Bertrand Le Roy has published a cool ScriptDoc utility that extracts documentation from JavaScript files and packages it into XML that can be consumed by documentation building tools.  A very useful tool as you start to build up your own JavaScript libraries.

    Visual Studio

    • GhostDoc 2.1.1 Released: GhostDoc is a free add-in for Visual Studio 2005 (and now 2008) that automatically generates default XML documentation comments for code you write in C# or VB.  It can automatically re-use existing documentation inherited from base classes or implemented interfaces, or generate initial documentation by deducing comments from the name and type of the member signature. You can learn more about it and download it for free here.

    Silverlight

    • Silverlight Tutorials: Michael Schwarz has a great blog where he writes regularly about Silverlight.  This tutorials link points to a bunch of great Silverlight content.

    IIS 7

    • IIS 7.0 is now running all of Microsoft.com: One of the things we push at Microsoft is to "dogfood" our products on our high volume sites when they enter the beta cycle.  As of a few weeks ago, all of the web servers running www.microsoft.com are now running on IIS7 and Windows 2008 Server Beta3.  These servers host 500+ virtual roots and 350 ASP.NET applications, and handle 300,000 concurrent connections.  IIS7 is going to be an awesome release.

    • IIS 7.0 on Server Core: Bill Staples blogs about some of the new IIS7 enhancements that appear with the June CTP of Windows 2008 Server.  One of the big features that is now supported is the ability to install IIS7 on "server core" - which is a low footprint installation of Windows 2008 Server that lays down just the minimal footprint needed to boot (meaning no GUI shell).  This lowers the resources required on servers, and even more importantly means that servers don't need to be updated if a patch is released for a component not installed on the server (which lowers the downtime of servers).  ASP.NET and the .NET Framework aren't supported yet in server core configurations - but will be in the future.

    Hope this helps,

    Scott

    P.S. I'm out on vacation this week, so please excuse delays on email and comment feedback.

  • Gotcha: Don't use <xhtmlConformance mode="Legacy"/> with ASP.NET AJAX

    Recently I've helped a few developers who have been having some weird JavaScript issues (both when using ASP.NET AJAX and with some other custom JavaScript routines they were using).  The culprit was that they had automatically migrated a VS 2003 Web Project to VS 2005, and still had the <xhtmlConformance mode="Legacy"/> switch configured within their web.config file. 

    If you are writing custom client-side JavaScript in your web application and/or are going to be using AJAX, please read-on to learn how to avoid a common gotcha (note: for a list of other tips, tricks, recipes and gotchas I've previously posted, please check out this page here).

    Symptom:

    You see strange behavior when adding new client-side JavaScript to a project that was previously upgraded (successfully) from VS 2003 to VS 2005.  When using ASP.NET AJAX UpdatePanel controls, this strange behavior can sometimes include cases where the page does a full-page postback instead of just incrementally updating pieces of a page. 

    When you open up your web.config file, you also see a <xhtmlConformance/> element within it like so:

    <configuration>

        
    <system.web>
            
    <xhtmlConformance mode="Legacy" />
        </
    system.web>

    </configuration>

    Background:

    ASP.NET 1.0 and 1.1 didn't emit XHTML compliant markup from many of its server controls.  ASP.NET 2.0 changed this and by default emits XHTML compliant markup from all controls (note: you can learn more about ASP.NET 2.0's standards compliance from this excellent MSDN article).

    One of the things we noticed in the early ASP.NET 2.0 betas, though, was that when upgrading customer applications a lot of the applications had assumptions that the page output was not XHTML compliant.  By changing our default output of the server controls to be XHTML, it sometimes modified the visual rendering of a page.  For backwards compatibility purposes we added the <xhtmlConformance> switch above that allows developers to render controls in "Legacy" mode (non-XHTML markup the same as ASP.NET 1.1) as well as Transitional mode (XHTML Transitional) as well as Strict mode (XHTML Strict). 

    By default when you use the VS 2003->VS 2005 Web Project Migration wizard (for both web sites and web application projects), your web.config file will have the legacy switch added.

    Solution:

    Unless you know of known issues that your site has when running in XHTML mode (and which you don't have time yet to fix), I'd always recommend removing the <xhtmlConformance> section from your web.config file (or you can explicitly set it to "Transitional" or "Strict"). 

    This will make your HTML output standards compliant.  Among other things, this will cause the HTML from your server controls to be "well formed" - meaning open and close tag elements always match.  This is particularly important when you are using AJAX techniques to dynamically replace the contents of certain HTML elements on your page (otherwise the client-side JavaScript sometimes gets confused about container elements and can lead to errors).  It will also ensure that ASP.NET AJAX works fine with your site.

    Hope this helps,

    Scott

  • Gotcha: Lost HTML Intellisense within ASP.NET AJAX Controls

    Symptom:

    You are using ASP.NET AJAX Beta1 or Beta2, and create a .aspx page that is based on a .master file.  You add the <asp:scriptmanger>, <asp:updatepanel>, <asp:updateprogress> or <asp:timer> control into the content page, and find that markup intellisense no longer works for these controls, or for any controls nested within them:

    In the screen-shot above notice how the ScriptManager, UpdatePanel and ContentTemplate tags have the little red-squiggly lines underneath them.  You also won't get tag completion when you type these elements in the document.  You can still compile and run just fine, and the WYSIWYG designer works just fine.  But you do lose source editor intellisense.

    Some Background on the Issue:

    ASP.NET 2.0 added support for registering controls (both compiled and .ascx user controls) within your web.config file - removing the need to always add <%@ Register %> directives at the top of your page.  For more details on this and to see a sample in action, please check out my Tips and Tricks talk from the recent ASP.NET Connections conference.

    One of the cool aspects of this feature is that it also now allows you to map the same tag prefix against multiple assemblies.  We use this with ASP.NET AJAX to have these controls use the <asp:> tag prefix, even though they live in a separate assembly from the system.web.dll file that contains the rest of ASP.NET.

    Unfortunately we discovered a bug with the VS markup intellisense engine when doing the ASP.NET AJAX Beta1 release - which is that you lose intellisense when you map multiple assemblies against the <asp:> tag prefix and use the controls within a <asp:content> control in a .aspx page based on a master page. 

    How to Fix This

    The fix for the intellisense issue will be in VS 2005 SP1.

    In the meantime there are two workarounds that you can use to fix it immediately:

    1) Keep the .master file open within the Visual Studio IDE when working on the .aspx content page.  It turns out the intellisense engine only runs into issues if the .master file is closed.  As long as it is open within the same IDE, it resolves the assemblies just fine and will give you full intellisense:

    The screen-shot above is with the exact same sample as the previous screen-shot.  The only difference is that I also have the Site.Master file open in the editor in the background.  When that file is open, I get full intellisense for the ASP.NET AJAX control elements and no intellisense errors.

    Alternatively you could instead use the below technique if you don't want to keep the .master file open:

    2) Go into your web.config file and change the tag-prefix naming for the ASP.NET AJAX controls to something other than <asp:>.  For example, instead of:

          <controls>
            
    <add tagPrefix="asp" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions" />
            <
    add tagPrefix="asp" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions" />
          </
    controls>

     

    change them to something like this:

     

          <controls>
            
    <add tagPrefix="ajax" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions" />
            <
    add tagPrefix="ajax" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions" />
          </
    controls>

    You'd then want to update your tag prefixes in your .aspx page to use this new tag prefix.

    Either of these approaches will solve the problem and deliver full intellisense.  The issue should then be resolved completely with VS 2005 SP1.

    Hope this helps (and sorry for the inconvenience),

    Scott

  • My ASP.NET 2.0 Tips, Tricks, Recipes and Gotchas "Highlights Page"

    Several people have sent me email lately asking for a suggested short-list of my best/favorite past blog posts to read (I’ve done 200 posts over the last 12 months and apparently it takes too long to read them all <g>). 

    I’ve put together a summary page of ASP.NET 2.0 Tips, Tricks, Recipes and Gotchas that you can check out here.  It currently contains links to 37 posts that I’ve done in the past that I think are interesting and worth spending sometime to read. 

    I’ve organized the list by area topic (UI, Data, Security, Visual Studio, etc).  My goal is to post at least 1-2 new/original ASP.NET Tips/Tricks/Recipes to my blog each week going forward.  I’ll also make sure to update the summary page above as I add new ones – so you might find it useful to bookmark if you want to quickly look them up.

    Hope this helps,

    Scott

    Share this post: Email it! | bookmark it! | digg it! | reddit!
Powered by Community Server, by Telligent Systems
'