ThreadAbortException

January 2008 Entries

Running Visual Studio 2005 on IIS7, Windows Vista

If you are working with Windows Vista and IIS7 and developing web applications using Visual Studio 2005, you might want to know certain things before you panic on getting issues with creating http://localhost applications running out of the IIS Webserver.

With Windows Vista, we ensured that security is the utmost important aspect and anything that needs an administrative privielege (could be running a script, could be creating a website in your webroot or simply could be changing your desktop resolution) needs to be confirmed by the end users, triggered by the UAC prompt.  If you had been working with Windows Vista, you would have noticed the UAC Prompt appear quite a few times for a number of things.  This though looks to be a nuisance, is a wonderful mechanism to prevent fradulent usage of administrative access by hackers.  Supposing you visit a site which internally downloads a script and tries to attach your OS System Files, unless the end user confirms, the UAC isnt going to allow to proceed with the operation.  Similarly, even downloaded desktop applications which try to mess with the operating system, are well covered by the UAC prompt. 

Coming to our case in point, for creating Web Applications running out of IIS7, you need to do a few things.  The first thing is to run your Visual Studio 2005 under admin priveleges.  You can do that by Start - Run - Visual Studio 2005 and right click on the Visual Studio 2005 icon and select "Run as Administrator".  By doing this you get the privelege to create web applications running out of IIS 7.  Alternatively you could also create web applications running out of your file folders without requiring the IIS 7.  This doesnt require you to chose "Run as Administrator".  In these cases, Visual Studio 2005 would use the built-in ASP.NET Server (http://localhost:PortNumber)

Similarly, at the IIS 7 end you need to do a few things.  The first step is to enable IIS7, by default, IIS 7 is not enabled in Windows Vista.  So visit Control panel - Add Remove Programs (a quick runtime command is "appwiz.cpl" from Run command).  Select "Turn Windows Features On or Off" and you would be prompted with a list of Windows Compnents (It takes a moment to load the bunch)

Once you are there, you would just want to do the following things:-

1. Scroll Down to the Internet Information Services (its below Indexing Services and above Microsoft .NET Framework 3.0)

2. Expand the tree next to Internet Information Services by clicking on the '+' sign.

3. Expand the IIS 6 Management Compatibility icon

4. Under that, make sure IIS Metabase and IIS 6 compatibility is Checked (Selected)

5. Since we havent checked (at least they arent checked by default) all the items, it (IIS 6 Management Compatibility) would be grayed (blue-filled)

6. Also select IIS 6 Management Console as checked

7. Similarly, under World Wide Web Services -> Application Development Features  make sure the following are checked

     i. .NET Extensibility, ii. ASP.NET, iii. ISAPI Extensions, iv. ISAPI Filters

8. The World Wide Web Services icon would also be a grayed (blue-filled) check box.

9.  Once you un-expand these and go back to Internet Information Services, you would find that it is also grayed (blue-filled) checkbox.

10. Click Ok and it would take quite sometime to install ASP.NET 2.0 and also install the features selected and configure them.

Post these steps, you should be able to run Visual Studio 2005 under administrative priveleges (Right click, Run as Administrator) and also created websites hosted on http://localhost (IIS 7 Webserver) as against creating them on your local folder structure.

Here below are a few blog posts which give a Visual Step-by-Step instructions incase you are unable to follow the above

http://weblogs.asp.net/scottgu/archive/2006/09/19/Tip_2F00_Trick_3A00_-Using-IIS7-on-Vista-with-VS-2005.aspx

http://blogs.msdn.com/webdevtools/archive/2006/09/18/761206.aspx

Cheers !!!

ASP.NET 3.5 Extensions Website - MediaPlayer - Play Videos in ASP.NET Web Pages

In the earlier post, we saw the "Dynamic Data Website" shipped with ASP.NET 3.5 Extensions Preview that can be used for rapid application development of data driven websites using Visual Studio 2008.

The ASP.NET 3.5 Extensions Preview can be installed from here  Once you install the same, you get a few things.  One, is that you get the 'Dynamic Data Website' template I talked about earlier.  The other thing is that you get the "ASP.NET 3.5 Extensions Website" template that allows you to create an ASP.NET 3.5 Website with the Extensions Preview features.

I know its confusing at this moment.  If you read back, we released ASP.NET 3.5 and Visual Studio 2008 during the fag end of 2007.  Along with that we also released an ASP.NET 3.5 Extensions Preview, a build that is currently a CTP where we are testing some of the new features that could be integrated as a part of SP1 for .NET 3.5 (and subsequently ASP.NET 3.5)

One of the features of the ASP.NET 3.5 Extensions is the Dynamic Data Controls that allows you to create Data Driven Websites using the LINQ to SQL and Dynamic Data Controls.  The other feature is the ASP.NET 3.5 Extensions Website that allows you to create ASP.NET Website where you can use all the controls / features that are currently in preview.

Phew !!!

So, once you create this ASP.NET 3.5 Extensions Website, the first thing you would notice is that, the version of AJAX (System.Web.Extensions.DLL) is 3.6.0.0 as opposed to 3.5.0.0. that would be in the case of a normal ASP.NET 3.5 Web Site (File - New - Website - ASP.NET Website in Visual Studio 2008).  Also you must be able to see a new tab in the toolbox reading "ASP.NET 3.5 Extensions".  Some of the controls that would be present in this tab are the ListView, DataPager, UpdatePanel, UpdateProgress, Timer and the ScriptManager, ScriptManagerProxy controls.  The version however, for these controls is again 3.6.0.0. which means that they would be the newer versions currently under preview.  The other things that you would notice is the Dynamic Data Controls like DynamicListView, DynamicDetailsView, DynamicGridView and DynamicFormView.  We will see about these controls in a later post.

The third set of controls you would notice are Silverlight and MediaPlayer controls which are very handy controls.  The MediaPlayer controls allows you to play videos on your ASP.NET Pages without the need to do much work.

Lets start examining this.  Open Visual Studio 2008, select "File - New - Website" andchose the "ASP.NET 3.5 Extensions Website"

Once you create the website, open the Default.aspx page and also expand the ASP.NET 3.5 Extensions Toolbox tab.  Drag and Drop the MediaPlayer control to your webpage.

Next is that we need to add a Video to our site.  Go to the root of the website and create a folder named "Videos" (We could do without this, but just a logical grouping).  Add an existing video that you can pick up from your machine.  By default, Windows Vista and Windows XP ships the Butterlfy.wmv and a couple of videos that you can use, in case you dont have any video on your machine.  These files (Butterfly.wmv etc.,) are usually located in C:\users\<username>\videos\Sample Videos in case of Windows Vista and at C:\Documents and Settings\<user name>\My Documents\My Videos in case of Windows XP.

So you can add these videos or any other video that you have in your machine to the 'Videos' folder that we created in the root of the website.

Now, switch to design view of the Default.aspx page and select the MediaPlayer Control.  You should see a "Silverlight" logo which indicates that the video would be hosted by Silverlight for the end users.  Click on the smart tag that shows up next to the MediaPlayer control where you can set the MediaPlayer Tasks.  Click on the browse button next to the Media Source TextBox to chose the video file.  It currently supports File formats.  You can chose a video of this file format from the 'Videos' folder that we created.  You can alWMV, MP3, WMA and ASX so set it to Mute or AutoPlay and change other properties using the properties window.

Thats it! You are good to go and play Videos in your web page.  The great advantage is that, this doesnt require the end users to have Windows Media Player to be installed since this would be powered by Silverlight.  The end users just need ot install Silverlight runtime for the first time and with the flood of Silverlight applications that we are witnessing these days, there are more than likely chances that your end users have already Silverlight running in their machines.  This means that you can play Videos on your ASP.NET Web pages without having any additional client installation.

For more information on further exploring MediaPlayer and creating chapters, check http://quickstarts.asp.net/3-5-extensions/silverlight/MediaPlayerControl.aspx

Cheers !!!

ASP.NET 3.5 Extensions Preview - Dynamic Data Controls

Earlier I had blogged about ASP.NET 3.5 Extensions Preview  and also the Dynamic Data Controls and how ASP.NET would be evolving into a comprehensive platform for rapid applicaiton development of Data Driven Websites.

While the earlier preview I talked about (Dynamic Data Controls) was a part of the ASP.NET "Futures" CTP, there is now a much better build of the Dynamic Data Controls which we shipped as a part of ASP.NET 3.5 Extensions Preview.

Simply putting, we would encourage you to try out the new Dynamic Data Controls that were shipped as a part of ASP.NET 3.5 Extensions Preview rather than the one that was shipped with ASP.NET "Futures" July 2007 CTP.

So, if you are working with ASP.NET 3.5 and Visual Studio 2008, I would recommend you uninstall the ASP.NET "Futures" July 2007 CTP from "Add/Remove Programs" and install ASP.NET 3.5 Extensions Preview from ASP.NET Extensions Preview Website  Once you install the same, you get a new "Dynamic Data Website" template, when you select "File - New - Website" in Visual Studio 2008.  This one has a wizard icon attached to it, or occasionally has a blank icon, so you can easily distinguish this template from the old "Dynamic Data Website" template shipped with ASP.NET "Futures" July 2007 CTP, just in case you hadnt uninstalled the same.

Ok, once you select the new "Dynamic Data Website" and create a website, you will be seeing a bunch of files created automatically.

To begin with, we will just use the existing templates and create a Data bound website quickly.  So, the first step in creating a Data Driven Website is to design the Data Access Layer.  To do that, select "Add - New - Item" and choose "Linq to SQL Classes" and provide a name say "Northwind.dbml".

Once the Linq to SQL file is created, open Server Explorer, connect to your Database instance.  Thereafter you can expand the "Tables" node and drag and drop a few tables into the Linq to SQL Visualizer.

Say, let us pick up the following tables

Products, Customers, Orders and Order_Details

The next step is just to build the solution and then your Data Access Layer built using LINQ to SQL is ready.   You could customize, modify all the code that is auto generated using the file Northwind.designer.cs but make sure you take care that you dont regenerate this file since it would wipe off all your customizations.

The next step would be expanding your web.config file and locating the setting "enableTemplates" property of &lt;dynamicData&gt; tag to "true".  Note that by default this is set to "false".

Thats it, you would be able to run the site and get the Default Page with a nice menu control linking to all the pages corresponding to the tables you had selected.

You could change the URL pattern, provide a different name, edit templates and do all other stuff with the auto-generated files and controls.

But to begin with, it provides you a full fledged funtional site with data in different formats, GridView, DetailsView, InsertTemplate, Filter etc., all of them AJAX Enabled.  If you had worked with the Dynamic Data Controls of the earlier build (ASP.NET "Futures" July 2007 CTP) you would have noticed that all the controls used in that build are in much better shape and AJAX Enabled too.

Cheers !!!

MIX '08 is here, Las Vegas, where else !!!

I had blogged about MIX 07 last year.  The event had siginifcant importance and the wonderful announcement of Silverlight which changed the way web programming and user experience is being talked about these days.

Now, here is MIX 08 happening this year, March 5 - 8th at the Venetian Hotel, Las Vegas.  I dont think the address requies more details, though

MIX 08 hosts Steve Ballmer Keynote, Scott Guthrie presenting on the new Silverlight release and few more exciting announcements.  To check agenda visit http://visitmix.com/2008/agenda.aspx

To get a special discounted registration visit http://visitmix.com/2008/registration.aspx and hurry up, you get this discount until Jan 31, 2008.

This event promises to have flood of information as well as opportunity for networking, partnerships as well as loads of fun, and do I need to say that since its happening at Las Vegas.

Cheers !!!

ASP.NET 2.0 AJAX Applications in Visual Studio 2008

Most of you who have worked with Visual Studio 2008 would love the fact that it supports multi-targetting i.e. targetting different versions of framework v2.0, v3.0 & v3.5.  To give a quick background, earlier versions of Visual Studio were tightly integrated with the framework to give maximum benefit.  See the chart below

.NET Framework 1.0      Visual Studio .NET 2002       

.NET Framework 1.1      Visual Studio .NET 2003

.NET Framework 2.0      Visual Studio 2005

.NET Framework 3.0      Visual Studio 2005 + Workflow Extensions, and VS 2005 Extensions for WPF & WCF

.NET Framework 3.5      Visual Studio 2008
.NET Framework 3.0 
.NET Framework 2.0

If you notice the above list, you find that there has been a respective tool for every version of the framework and none of them can be interchanged i.e. .NET Framework 2.0 doesnt work with Visual Studio .NET 2003 and Visual Studio .NET 2002 cannot be used to create applications targetting .NET Framework 1.1. 

But with .NET 3.0 we didnt have an equivalent Visual Studio edition.  Instead you just have to download the extensions (for free) and use Visual Studio 2005 for creating WPF, WCF, WF and WCS Applications.

Also, ASP.NET AJAX v1.0 was released as a separate add-on to work with ASP.NET 2.0 and Visual Studio 2005.

So when you open an application written using Visual Studio .NET 2003 and .NET Framework 1.1 in Visual Studio 2005 editor, it will give you the conversion wizard for upgrading to .NET Framework 2.0.  This was sort of annoying for certain people who wanted to retain the framework version but still work with the newer version of the tool. 

With Visual Studio 2008 we ensured that you can create / open applications targetting .NET Framework 3.5, 3.0 and 2.0.  The File - New - Project / Website wizard provides you the drop down to chose the framework version to target.  Based on the version of framework you chose, the relevant templates, references and toolbox get generated.

Coming to the original intent of the post, if you want to use Visual Studio 2008 and create an ASP.NET 2.0 Application you could do it out of the box as described earlier.  However, if you want to use ASP.NET 2.0 as well as the ASP.NET AJAX v1.0 Library there is no built-in "AJAX Enabled ASP.NET 2.0 Website" template to achieve this.

But we shipped "Microsoft ASP.NET 2.0 AJAX Templates for Visual Studio 2008" in mid December 2007 as an add-on that one can install on top of Visual Studio 2008.  Once installed, it gives you the option to create ASP.NET 2.0 AJAX Enabled Website using Visual Studio 2008.

You can downlod this add-on for free from here

This is only when you want to use ASP.NET AJAX v1.0 and ASP.NET 2.0 while working with Visual Studio 2008.  If you chose the framework target version as .NET 3.5, then a simple File - New - ASP.NET Website has built in AJAX Library and controls that can be used.

Well, its quite a lot of information and confusing as well.  So feel free to ask if you have a doubt.

Cheers !!!

ASP.NET Extensions 3.5 and Dynamic Data Controls

I have blogged about ASP.NET "Futures" and Dynamic Data Controls in my earlier post.  You could create a Data Driven Website very quickly using the "Dynamic Data Website" template that shipped with the ASP.NET "Futures" July 2007 CTP.

However, the ASP.NET Extensions 3.5 shipped in December 2007 bundles a bunch of Dynamic Data Controls that are more powerful and offer more extensibility than the ones shipped with the ASP.NET "Futures" July 2007 CTP.  Let me clarify a few things here on the releases:- (Feel free to correct me if I have missed out something)

November 2005   
ASP.NET 2.0 Released along with Visual Studio 2005  (No ASP.NET AJAX)

January 2007        
ASP.NET AJAX v1.0 released as an add-on to ASP.NET 2.0 (Works with Visual Studio 2005)

May 2007               
ASP.NET "Futures" a developer preview of some of the features considered for future releases released as a CTP

July 2007
ASP.NET "Futures" CTP Updated

November 2007   
ASP.NET 3.5 and Visual Studio 2008 released (ASP.NET 3.5 contains built-in newer version of ASP.NET AJAX, ListView, DataPager and LinqDataSource controls)

December 2007  
ASP.NET 3.5 Exensions (CTP Version containing new features for ASP.NET, AJAX and Silverlight)

Going further, ASP.NET "Futures" would still be updated as CTPs offering a developer preview of further new things considered for future versions, at an early stage. However, the Dynamic Data Controls that were a part of the ASP.NET "Futures" (July 2007 CTP) are becoming obsolete and the ASP.NET 3.5 Extensions Dynamic Data Controls is what would be continued and shipped.

If you have attended my sessions on ASP.NET "Futures" and Dynamic Data Websites, you would be excited to hear that with this extensions CTP, you get much more better support for customization, validation etc.,

Currently I am playing with the same and would follow this post up with newer posts on the same.

Cheers !!!

A network error occured while attempting to read from the file: C:\Windows\Installer\Astoria[1].msi

If you were playing with the early bits of Microsoft Codename 'Astoria' MIX 2007 CTP you would have really loved the power of Data Services. 

Well, with ASP.NET 3.5 Extensions, ADO.NET Data Services (formerly 'Astoria') is built-in and while trying to install ASP.NET 3.5 Extensions it would prompt you to uninstall earlier bits of 'Astoria'.  I had installed very early bits of Astoria and there was 3.3 GB Size CTP lying in my "Add/Remove Programs" . 

When I tried to uninstall the same, it would end up half the way.  It simply wouldnt uninstall and I get the error message "A network error occured while attempting to read from the file: C:\Windows\Installer\Astoria[1].msi"

This was frustrating, I reinstalled the earlier bits again and uninstalled but still this 3.3GB thing didnt get removed.  Finally I went to the Astoria MIX 2007 Download Page and downloaded the installer instead of "Opening" it (you can do that when it prompts to Run or Save the MSI - select Save).  Finally I copied this installer bit into the C:\Windows\Installer folder and renamed the 'Astoria.msi' to 'Astoria[1].msi' (at least it seemed to have lbeen ooking for this file from the error message)

Then, I could uninstall the 3.3 GB Bits which was worrying me for 2 reasons - One is the size that was scary, only Visual Web Developer 2005 was the next big one with 2.5 GB.  Secondly, I didnt want this CTP to mess with ASP.NET 3.5 Extensions build.

Anyways, now all this well and this post was to help with anyone who ends up searching for this particular error

Cheers !!!

Microsoft Security Summit 2007

We recently concluded the Microsoft Security Summit 2007 in 4 cities.  I had blogged about this in my earlier post

If you happened to attend the Chennai event, well,  I was present over there doing keynote and other announcements, for a change.

Well, the purpose of this post is to help you download all the presentations.  You can download the same from http://www.microsoft.com/india/security/ss-dev.aspx

Cheers !!!