in

ASP.NET Weblogs

ShankuN's Blog

The Online Weblog of Shanku Niyogi, ASP.NET Group Program Manager
  • My New Blog, and Atlas for PHP

    As part of a New Year's resolution that's a little overdue :) , I have just rolled out a new blog at http://www.shankun.com. That will be place to find new posts by me.

    One of the first posts on the new site is an article on how to host Atlas with PHP, along with code for the sample I showed at the MIX 06 conference.

    Do you have other things you'd like me to blog about? Send requests to this post, or through my site.

    Posted Apr 05 2006, 01:04 AM by ShankuN with no comments
    Filed under:
  • Atlas blog

    Rich Ersek has created a new Atlas blog for official announcements about Atlas, at http://weblogs.asp.net/atlas. We'll be using this blog to announce updates to the Atlas site at http://atlas.asp.net, including updated preview bits, new samples and quickstarts, and articles. We're going to be updating the PDC preview bits with bug fixes in the next few days, and then make new releases available every month or so.

    If you want to keep track of what's happening with Atlas, please subscribe to the RSS feed for the Atlas Blog.

    Posted Oct 05 2005, 11:32 AM by ShankuN with no comments
    Filed under: ,
  • PDC 2005 Slides and Demo code

    I've uploaded the slides and demo source code for my PDC 2005 presentation on Atlas.

    To run the demo code, you need Visual Studio 2005 Beta 2, the SQL Express 2005 CTP that came with it, and the Atlas Preview bits, found on atlas.asp.net. Install the Atlas demo, and then create a new Atlas project on the filesystem. You can then expand the demo files into the same directory. If you're using IIS, you will also need to give write access to the ASPNET user to the App_Data directory of the site.

    Some notes on the demo contents:

    1. The database (App_Data\TaskList.mdf) contains the schema for the tasklist. A second database, containing membership and profile info, is generated automatically. You can configure these using the connectionStrings settings in web.config.
    2. The app_code directory contains the Task and TaskList business objects, the TaskListService, and the DAL code in the Providers directory.
    3. The demo includes the conventional ASP.NET version of the site, in default.aspx and list.aspx.
    4. The demo also includes UI to login and register users, in Login.aspx and Register.aspx.
    5. A number of asmx files wrap the functionality in TaskListService.cs into web services.
    6. AtlasDefault.aspx contains the Atlas version of the list editing UI, showing use of data sources, master details, client-side editing of a DataSource, client-side data insertion, hover behaviors, and autocomplete.
    7. AllItems.aspx shows how to use the floating behavior with the profile service to do personalized, interactive UI.

    Let me know if you have any questions or problems. Enjoy!

    Posted Sep 21 2005, 01:46 PM by ShankuN with 6 comment(s)
    Filed under: ,
  • ASP.NET Atlas is now live!

    This morning, we just showed Atlas for the first time to the public in Jim Allchin's keynote at PDC 2005. We've been working on Atlas for a few months now, and it's very exciting to be able to have an early preview release in everyone's hands at PDC.

    So, how do you get your hands on these Atlas bits? Go check out the Atlas community site at http://atlas.asp.net. Here, you can get download Atlas for use with Whidbey Beta 2. The Atlas preview downloads as a VSI that installs into your Visual Studio Beta 2 release - you get new project items to start building Atlas apps.

    We also have some documentation available to help you explore Atlas - including some conceptual docs, the full set of Atlas hands-on labs that PDC attendees are using, and a set of quickstarts to help you learn Atlas. The key to the site, of course, is the feedback we get from you - so we have a set of Atlas forums, and pointers to blogs hosted by team members such as Nikhil, Bertrand, and Jonathan.

    Our ultimate goal with the Atlas site is to build a great developer community around Atlas, and get your valuable input to help build the right product. We'll release updates of our community preview on a frequent basis, as well as samples and documentation. I

    If you're attending PDC this week, we've got a couple of talks later this week - an overview talk by myself tomorrow at 5, and a custom controls and components talk by Nikhil on Thursday morning. If you didn't get to attend PDC this year, we'll be making the slides and demos from our PDC Atlas talks available on the site in the next few days.

    Have fun playing with Atlas! And if you'd like to see us talk more about Atlas on the blogs, let me know.

  • Upcoming Changes to ASP.NET 2.0 in Beta 2

    We have recently completed planning for Beta 2 of ASP.NET 2.0 and Visual Studio 2005. For the Beta 2 release, we will deliver a high quality release with a go live license to enable live deployments. To do this, we need to focus on finding and fixing bugs, and raising security, performance, and scalability through targeted analysis and improvements. We also are getting great customer feedback from Beta 1 and earlier preview releases, and need to incorporate key feedback into the product.

     

    To enable us to meet these goals, and in response to customer feedback, we have decided to remove a small set of features from ASP.NET 2.0. These features are already available in Beta 1, so we’d like to provide you with some advance notice of what changes are coming, and how you can prepare for them.

     

    Note: You can find an ASP.NET forums post with the same content at http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=667498.

     

    Mobile Device Adapters for ASP.NET Server Controls

     

    ASP.NET 2.0 Beta 1 introduced a new control adapter architecture that allows any ASP.NET server control to create alternate renderings for other browsers, including mobile devices. We also included adapters for many of our built-in server controls, to allow developers to use them to create mobile web applications. At the same time, Beta 1 deprecated the ASP.NET mobile controls, which were used in ASP.NET 1.x to build mobile web applications.

     

    In Beta 2, we have decided not to deprecate the V1.x mobile controls. We have instead postponed our plans to ship mobile specific adapters for all controls until a later release.

    If you plan on writing a mobile web application using ASP.NET 2.0, we recommend that you use the ASP.NET mobile controls, found in System.Web.Mobile.dll.

     

    We have also decided not to specifically certify individual new devices for use with the mobile controls, through our product release and device updates. Instead, we will provide adapters for V1.x mobile controls that render markup compliant with common markup languages – HTML, cHTML, XHTML Mobile Profile, and CHTML – and work on standard browsers. For many applications, these adapters will work out of the box for a variety of devices. If desired, you can fine-tune your application for an individual device by creating a new device profile and writing new adapters as necessary. We will provide a profiling tool and adapter source to help you customize your applications.

     

    We still plan on including the new control adapter architecture in ASP.NET 2.0. You can write control adapters to customize server controls for individual browsers. For example, you can write a control adapter to generate a different rendering for the Calendar control on Internet Explorer.

     

    PhoneLink and ContentPager Controls

     

    The mobile support in ASP.NET 2.0 Beta 1 included two new controls that were intended to supersede two features of the ASP.NET mobile controls: the PhoneLink server control to replace the PhoneCall mobile control, and the ContentPager control to replace the ability of mobile forms to automatically paginate content according to the screen size of the target browser.

     

    Now that we are bringing back the ASP.NET mobile controls, you can implement these features using . To include a link to a phone number in your page, use the System.Web.UI.MobileControls.PhoneCall control. To paginate the contents of your form, use the Paginate property of the System.Web.UI.MobileControls.Form control.

     

    The ContentPager control also allowed developers to paginate the contents of controls for desktop browsers. To create a paginated UI in ASP.NET without the ContentPager control, you can either use a GridView control, which has built-in support for pagination, or extend the DataList control with support for pagination. For an example of a pagination UI on ASP.NET, please refer to the MSDN article Creating a Pager Control for ASP.NET by Dino Esposito.

     

    Site counters, DynamicImage Control, and the Image Generation Service

     

    After receiving feedback and conducting internal testing and evaluation, we have decided that these features require significant additions or changes in response to customer feedback, or significant additional testing to meet stability or scalability requirements. We have decided to remove these features for ASP.NET 2.0, and will look at adding them in a future version.

     

    To employ click tracking on your site in ASP.NET 2.0, we recommend you use a 3rd party solution or build your own using page code.

     

    To dynamically generate images from content in a database or from data, you can write an ASP.NET handler (.ashx), and use the ASP.NET cache to store these generated images. The code example at the end of this post (see below) shows a handler that returns an image generated from a business object.

     

    WebPartPageMenu Control

     

    This control provided a convenient mechanism for switching page personalization modes in pages using the web parts control set. The UI generated by this control is a dropdown list or menu similar to Sharepoint. However, pages often require more flexibility for switching modes than this control provides, and the WebPartManager class makes it easy to programmatically switch personalization mode from any server control.  

     

    To switch modes, you can use an interactive server control such as a Button, LinkButton, or DropDownList, and write an event handler for it that programmatically switches the personalization mode. For example, the following code will switch the personalization mode of a WebPartManager:

     

    WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode

     

    Access Data Providers

     

    In Beta 1, ASP.NET application services such as membership and roles include Access data providers, and use them by default. In Beta 2, however, we will replace this functionality with support for SQL Server 2005 Express Edition, the new version of SQL Server which combines the file-based simplicity of Access databases with seamless deployment to full editions of SQL Server.  The developer model of using the application services stays 100% the same, but the backend implementation will now be much more robust and performant.

     

    DataSetDataSource

     

    This control provided the ability to bind to an XML data source using a dataset, but had significant overlap with XmlDataSource (which allows binding to XML data) and ObjectDataSource (which allows binding to data components). We are eliminating this control in the interests of simplicity.

     

    Built-in Global Themes

     

    Global themes provide a useful way to apply a standard consistent look to web pages, and we anticipate that developers will create and exchange a variety of global themes. However, we have decided not to include any built-in general themes in the product. Developers looking for an attractive set of built-in styles for server controls can use autoformats instead. We will also have an online theme gallery on www.asp.net for RTM that will enable developers to find and share themes for their site.

     

    Web Administration Tool Profile/Reports Tab

     

    This feature was incomplete in Beta 1, and we have decided not to complete the work in Beta 2. We will release samples that show how to get reporting from profile data.

     

     

     

    Example – An ASP.NET handler that returns a dynamically generated image

     

    <%@ WebHandler Language="C#" Class="ImageHandler" %>

     

    using System;

    using System.Drawing;

    using System.Drawing.Imaging;

    using System.IO;

    using System.Web;

    using System.Web.Caching;

     

    public class ImageHandler : IHttpHandler {

       

        public void ProcessRequest (HttpContext context) {

           

            // Get the image ID from querystring, and use it to generate a cache key.

     

            String imageID = context.Request.QueryString["PhotoID"];

            String cacheKey = context.Request.CurrentExecutionFilePath + ":" + imageID;

     

            Byte[] imageBytes;

                   

            // Check if the cache contains the image.

     

            Object cachedImageBytes = context.Cache.Get(cacheKey);

            if (cachedImageBytes != null)

            {

                imageBytes = (Byte[])cachedImageBytes;

            }

            else

            {

                // Get image from business layer, and save it into a Byte array as JPEG.

                Image im = PhotoLibrary.GetImage("PhotoID");

                MemoryStream stream = new MemoryStream();

                im.Save(stream, ImageFormat.Jpeg);

                stream.Close();

                im.Dispose();

                imageBytes = stream.GetBuffer();

     

                // Store it in the cache (to be expired after 2 hours).

     

                context.Cache.Add(cacheKey, imageBytes, null,

                    DateTime.MaxValue, new TimeSpan(2, 0, 0),

                    CacheItemPriority.Normal, null);

            }

           

            // Send back image.

            context.Response.ContentType = "image/jpeg";

            context.Response.Cache.SetCacheability(HttpCacheability.Public);

            context.Response.BufferOutput = false;

            context.Response.OutputStream.Write(imageBytes, 0, imageBytes.Length);

        }

     

        public bool IsReusable {

            get {

                return false;

            }

        }

    }

  • ASP.NET Request Validation and Cross-Site Scripting

    Anil has some interesting observations about Julia's posting on the ASP.NET Request Validation feature in ASP.NET 1.1, which provides some protection against cross-site scripting attacks.

    A bit of background on this feature:

    After we shipped v1.0, one of the pieces of customer feedback we got was that it was too easy for developers to make the mistake of leaving their site unprotected from cross-site scripting attacks. In fact, Dmitry, our dev manager, actually went on several prominent commercial sites (some, but not all, running ASP or ASP.NET), and found that a few were prone to cross-site scripting attacks.

    As part of the philosophy of securing by default, we decided to create the request validation feature, and turn it on by default, so that all pages immediately got protected. Of course, this meant we'd have the usual problem for security lockdown types of issues, which is backward compatibility. If your page actually expects input that would be blocked by request validation - for example, HTML text with tags - your page would break by default.

    So, we provided two ways to turn it off. First, on an individual page basis:

    <%@ Page ValidateRequest=”false” %>

    And secondly, on a whole site basis by changing the <pages> section of web.config.

    The recommendation, of course, was that you turn off the minimum number of pages you need to turn off, but only after verifying whether the page encodes request variables properly. As Anil said, if a 3rd party app you receive abuses this, or a control vendor tells you to turn this off for the entire app, you should rightly question whether the app or component is secure.

    There's also some programmatic access to request validation - Victor's post explains this stuff really well.

    Note: As G. Andrew Duthie points out on Anil's post, we didn't quite get it right the first time - there's been a patch to fix a problem in this feature.

    Posted Mar 02 2004, 02:36 AM by ShankuN with 16 comment(s)
    Filed under:
  • ASP.NET Whidbey Starter Kit Guidelines

    This month, we're putting together the overall plan and guidelines for Starter Kits for ASP.NET Whidbey. Jeff King (Scott's PDC keynote demo buddy) is managing the overall Starter Kit plan for our team, and has been putting together some samples. Over the next few months, I'll use this blog to share some of the starter kit designs and ideas with you, and get your feedback. If you have any ideas at any time, feel free to shout!

    Like V1, the aim of the starter kits is to have real world applications that work “out of the box”, but are easy and tempting to customize.  The first step is to put together a set of guidelines for consistency that apply to any starter kit; we'll then use these guidelines to create specs for each specific starter kit as we develop them. We'll also provide these guidelines for those in the community building projects that look like starter kits.

    As you may or may not know, in Whidbey many groups in VS are shipping similar starter kits. One big goal of the starter kits in Whidbey is that you can install them into Visual Studio, and have them appear in File/New - in our case from the File/New Web Site menu item. We will then ship a set of starter kits right in Visual Studio. Of course, we will continue to provide them for free over the web, and we'll also use the web to provide updates for the VS starter kits.

    Here is an outline of some of the current common requirements for ASP.NET Starter Kits:

    Client IE6, Netscape 7 (in Beta 1)
    Opera 7, Safari 1.2 (in Beta 2)
    Hosting All kits will be maximally functional under shared hosting under partial trust.
    Common Look/Feel All common elements between pages on a site must be in master pages.
    Kits need to implement one theme and be easily customizable using themes.
    Membership Kits will use forms authentication, using the membership system, whenever possible and relevant.
    Windows authentication will only be the default for intranet-based Kits.
    Navigation Site navigation should be easy to use, and use the sitemap feature whenever possible.
    Data Will support XCopy deployment, but also have scripts to install the kit on a SQL server.
    Localization All sites will be localized into the standard VS languages.
    Sites that include scenarios for end-user localization should use the ASP.NET localization features in Whidbey.
    Administration All kits can be administered using the Web Administration tool in Whidbey.
    XHTML Validation All kits will pass XHTML 1.1 validation from the W3C site.
    Accessibility All sites will be ADA508 conformant.
    Programming Languages VB, C#, J#

    What do you think? Anything you disagree with, or would suggest adding (or removing)?

  • Commodore 64

    Duncan's post on the Commodore 64 brings back a flood of memories. 

    The Commodore 64 was really my first major computer. Although I used several others at school or friends' (like the TRS-80, PET, TI-99/4A, the Atari 800, the Apple IIe, and the original Mac), the 64 was the first computer I owned.

    I got my Commodore 64 for my 12th birthday - we forked out Cdn. $1500 for a system that included a C64, a 1541 floppy drive (170K!), and a 1526 printer. We added a 1701 monitor a few months later - it was the only component I still had by the time I entered university, because it had RCA jacks for inputs, which made it great for a dorm room TV.

    Some random memories:

    • The 1526 printer was a big mistake. It was billed as a near-letter-quality printer (and the default printout was definitely better than the 1525. But, unlike the 1525, where you could individually access dots on a line, the 1526 only let you define an 8x8 “custom character“ per line. So, when word processors and tools with better fonts (like Print Master) came out, they would support the 1525 well; but on the 1526 (if the software supported it at all), you'd have to print each 8x8 block, then do a carriage return (without a line feed), and then print the next block and so on. It was painful to watch. It's why I used Print Master instead of Print Shop

    • I loved playing a game called Micro League Baseball, but I think the disk had a copy protection mechanism where the second track was bad (or maybe it was just my disk). Now, 1541 drives also had frequent problems with the heads misaligning, and it would cost $50 to fix. But I found that if I put the MLB disk in, and then used a tool to seek to the track from the right direction (from track 1 or 3), it would cause the drive to stutter around until it threw back into proper alignment. Scary stuff. Apparently, I am not the only one that loved MLB. Matt McEnerny, lead designer for Inside Pitch Baseball, counts it as his favorite game.

    • I remember getting the monthly issue of Compute magazine (and, later, Compute's Gazette, which was dedicated to the Commodore). It was a lot like MSDN magazine, but each article came with a complete listing, usually in machine language, and you had to enter the program by hand into the computer. They had a couple of programs (like MLX) that would show checksums for every line you entered, so you didn't get any lines wrong. But some tools were better than others, and you could make mistakes and still get the right checksum (or worse, sometimes the magazine would print the wrong checksum). I still remember the thrill of getting to the end of typing in the long listing of hex byte sequences, followed by the pain of it not running. But the magazine was great, at least in its early years - they had an entire free word processor called SpeedScript, that fit in 6K!

    • I didn't use SpeedScript though, I used a product called Paper Clip. It was a bit more complex, but it served all my needs through high school. And when my uncle wanted to publish a book, I did the entire manuscript in Paper Clip. Later versions came on two floppies, and you had to switch floppies to check spelling, or do a bunch of other things. The innovations you had to do to work within memory constraints in those days - Paper Clip had a dynamic module loading/unloading system.

    • My favorite games were the Epyx sports simulations - Summer Games, Winter Games, World Games, etc. I remember sprinting fast by hammering the joystick back and forth as fast as I could.

    • Late in its life, the 64 got a boost from a GUI OS called GEOS. I didn't have much of a need for this at the time (I had access to a Mac at school). But it had a whole new programming methodology, complete with a programmer's guide - I remember being drawn to it because of how different it was to write GEOS programs.

    There's a real nice site on the history of the C64, including what happened to Commodore and it's leaders. If you really want to revisit memory lane, you can use one of the very good C-64 emulators. There's even a couple of web browsers for the 64!

    Posted Feb 22 2004, 02:58 PM by ShankuN with 4 comment(s)
    Filed under:
  • Woohoo, I'm online!

    It's been a while since Rob set this up for me, but I'm finally online and blogging. My only hope is that I can keep it updated with frequent entries!

    For those of you who don't know me, here's a brief bio, from the February 2004 aspnetPRO magazine:

    As the Group Program Manager of the ASP.NET team at Microsoft, Shanku Niyogi leads the program management team responsible for design of both ASP.NET and Microsoft’s web development toolset in Visual Studio.NET.

    Shanku joined Microsoft as a developer in 1998, with several years of experience in the Windows software industry. He worked on both Windows and web versions of Microsoft’s chat software, before going on to be a development lead on the Adaptive User Interface team, looking at the problem of adapting user interfaces to different form factors. This work led to the design and development of the ASP.NET Mobile Controls. Shanku then joined the ASP.NET team as an architect in 2002, helping prototype and design several features of the next version (“Whidbey”) of ASP.NET, before switching to the PM role this year.

    Outside work, Shanku is predominantly occupied with playing with his daughter Acacia. Shanku is Canadian, and a graduate of the University of Waterloo, but his Indian heritage accounts for his obsession with trains and cricket.

    Posted Feb 19 2004, 01:53 PM by ShankuN with 9 comment(s)
    Filed under:
More Posts