Authentication, Cross-App Redirects, and ASP.NET 4.5

I started to test out the migration of our web applications with ASP.NET 4.5. In many cases, we have a login page that redirects from one domain to another domain or sub-domain. In those instances, we’re setting the enableCrossAppRedirects property in the configuration files. You can find out more about setting this by visiting MSDN at http://msdn.microsoft.com/en-us/library/eb0zx8fc(v=VS.100).aspx.

After upgrading the web server to ASP.NET 4.5, we noticed this stopped working. The users would hit the other domain and be redirected back to the authentication domain. Some digging around (and help from Barry Dorrans) lead us to two possible solutions:

  1. We need to ensure that all web servers that are running this machines are up to date with their ASP.NET security patches.
  2. If we are forcing one of our applications to use the ASP.NET 4.5 runtime, that same application will need to have the appropriate machineKey CompatibilitySetting checked off. We’ll look at this in greater detail below.

Updating ASP.NET

Chances are, we may not have all of our servers running this application up to date. The updates that are the most critical are those found in MS11-100. However, be sure to check Windows Update for all ASP.NET updates. If after patching the issue persists, continue on to the next section.

Setting the MachineKeySection.CompatibilityMode Property

If one of our applications contains <httpRuntime targetFramework="4.5" />, we need to make sure that this application’s machineKey is updated with the proper setting. Be default, if our other web application is using .NET Framework 2.0 SP1 or earlier, we shouldn’t have to set anything as the CompatibilityMode should infer the value Framework20SP1. Otherwise, if we are running .NET Framework 2.0 SP2 or later (but not running .NET Framework 4.5), we should use the value Framework20SP2. Our machineKey should look like the following:

<machineKey compatibilityMode="Framework20SP2" … />

Hopefully, one of these two solutions should solve our issue.



Remembering 9/11 (from a Developer’s Perspective)

I can still remember today, 11 years later. I was just about to walk in late to my English class at Penn State University when I heard that the first tower was hit on 97.9x. At the time Freddie Fabbri (the insignificant significant one) was the DJ (known best for his role in assisting Breaking Benjamin). He was about to break to another song when when he said that he received word that one of the World Trade Center towers was hit. From that point forward, none of us could ever imagine what was about to happen.


Looking back 11 years later, it reminds me of how technology changed as a whole. Disaster Recovery, Virtualization, and being mobile have all taken off. At times, it makes me wonder if this tragic event forced further development into these areas. Groups such as Wall Street West had formed in and around my area.


This was a period of time before smartphones really existed. Rather, it was uncommon to see a “suit” walking around without a Palm Pilot and Blackberry was just 2 years old. There also were no tablets. But, the first iPod was released by Apple later that year. Wikipedia was launched. Napster was closed down. Windows XP was released. The Code Red worm infected machines. And developers were still using Microsoft Visual Studio 6, Microsoft Visual Interdev and Java to build applications. There were no clouds to store data. DLLs were everywhere. And a developer would write JavaScript to select elements by ID by typing document.getElementByID("foo");.


A lot has changed in those 11 years. However, the memories of those that were around on that tragic day have not. To all of those affected by 9/11, our thoughts and prayers are still with you.


WTC



I’ll be Speaking at NEPA BlogCon 2012


Do I really need to say anymore? NEPA BlogCon will be one of the best conferences in Northeastern Pennsylvania. This is coming from the guy that assists in organizing TECHbash and NEPA GiveCamp. My talk will be about starting blogging and using a CMS to it’s fullest abilities. We’ll check out WordPress, Blogger, and Orchard CMS. I’ll show how to customize and extend each.


Would you like to go to NEPA BlogCon?  Get your tickets now at http://nepablogcon.com/buy-a-ticket/ and save 25% by using discount code: dotnetvalley.


Hope to see you there!



Save Sent Items in Correct Folder when Using Multiple Exchange Mailboxes

In Microsoft Outlook 2003, 2007, 2010, and 2013 (beta), you can add multiple Microsoft Exchange mailboxes by going into your Outlook account, and adding mailboxes like so:

sample

However, when you send email messages from one of these additional mailboxes, you’d notice that your sent items would go into your primary mailbox’s sent items. This is a bug in Outlook. However, there is a hotfix for Outlook 2003, 2007, and 2010 to resolve this issue. For these versions of Microsoft Outlook, you can download the appropriate hotfix below:

After that is applied, a registery key needs to be added. The key that is added needs to be in HKEY_CURRENT_USER\Software\Microsoft\Office\{OfficeVersion}\Outlook\Preferenceswhere {OfficeVersion} is the following:

  • Outlook 2003 – 11.0
  • Outlook 2007 – 12.0
  • Outlook 2010 – 14.0
  • Outlook 2013 – 15.0

The key to add is a DWORD key named DelegateSentItemsStyle. The value for this key should be 1.

Using Outlook 2010 or Outlook 2013

If you are using Outlook 2010 or Outlook 2013, there’s a better solution. Starting in Outlook 2010, the application would allow you to add more than one Microsoft Exchange mailbox per profile. This solves this issue without applying these hotfixes.



Old Deployment Options Abandoned in Visual Studio 2012

One of my colleagues found out earlier today that a project he recently upgraded to Visual Studio 2012 was broken. What caused this? The setup project that was added to his solution. Back on July 15th, 2010, a program manager from Microsoft posted that Microsoft was abandoning the Visual Studio 2012 setup options in favor of InstallShield LE. While InstallShield does have it’s purpose and many consider it to be the best (or only) real setup solution out there, the Microsoft team offers no standalone installer out of the box. This means developers must be forced to use ClickOnce, Windows Store, InstallShield LE, or another product they purchase.

If you are one of the developers that use the old setup project types, be sure to tell Microsoft you want them back – even if that means it’s a separate add-on or open sourced project on CodePlex.

Vote to get these options back by visiting http://jasong.us/PiUww7.



Customize the Color Scheme and Theme of Visual Studio 2012

During early builds of Visual Studio 2012, many developers griped and complained about the lack of color within the application. By the time VS2012 has RTM’d, two themes shipped with VS2012. There is a light theme and a dark theme.

Recently, the Visual Studio team took this to a whole new level. Not only have they added additional UI update options to the Visual Studio customization options, but they now have seven new themes including a dark background with light editor, a light background with a dark editor, blue, red, purple, green, and tan.

screenshot

To download this add-in, visit the website at http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05.

Special thanks to the team for developing this. Hopefully they include it out of the box in a future service pack or other application update.



Setting up Virtualization using Hyper-V for Windows 8

So you’ve downloaded Windows 8, installed it on your box, and are ready to get virtual machines (VMs) setup. Now what? In Windows 7 days, this could be accomplished by using Virtual PC or VirtualBox (an offering from Oracle). With Windows 8, VirtualBox is still available. However, Windows 8 comes with a new feature that’s been available for several years from Microsoft in Windows Server called Hyper-V.

To install Hyper-V, navigate to the charm menu (right-side menu) and choose Search. Type in ‘Programs and Features’ in the search box, click the Settings option underneath (as shown below), then click on the item to the left.

image

When Programs and Features load, click the link to Turn Windows features on or off like the image below:

image

Check the box to turn on Hyper-V and click OK.

image

Continue through the normal prompts to set it up. Once it’s done, we’re ready to setup our first VM.

Go back into Search and type ‘Hyper-V Manager’. When it loads, you’ll notice that the right-hand menu has many options.

image

Since we just care about getting a VM up and running for now, we’ll focus on creating a new VM. Before we choose New and create a new VM, if we’d like our VM to connect to the Internet (and to our host machine), we’ll want to hop into the Virtual Switch Manager and create some NICs to share with our VM. In a server environment, we’ll typically want to keep our host NICs separate from our VM NICs. However, in our case, we probably don’t care and if we have a laptop, chances are we only have an onboard NIC, wireless NIC, and our Internal that we’ll setup.

An example of this is shown below:

image

Now that we have our NICs setup, we should create our hard drive. We could use the wizard and setup the hard drive through it. However, our options are limited to using thin provisioning, a technique where our hard drive grows dynamically. I’d prefer to setup my hard drive as a fixed disk as I may install applications such as Microsoft SQL Server for testing out applications. The reasoning behind this has to deal with performance when the data is growing dynamically within an application. I can run into some unexpected results. If I’m ok with that, I may choose to create a dynamic disk.

Anyhow, I’ll choose New > Hard Disk. If I plan to only use Hyper-V for this hard drive and never use it with Virtual PC again and only use it in Windows 8 or Windows Server 2012, I can choose VHDX. Otherwise, I’ll choose VHD. VHD has a 2 TB limit and can become corrupt during power failures. I’ll choose VHDX, then fixed size on the next screen, name my hard disk and then proceed to configure.

In Windows 8, we have some really cool features for our virtual disk.

image

Notice that we can create a new disk, copy the data from a pre-existing hard drive (ie: the main computer hard disk or an external USB drive), or to copy another VHD or VHDX. For this case, I want to create a blank drive. I’ll then hit Finish to create my disk.

Now that my disk is created, I’ll finally choose New > Virtual Machine. I’ll get to name my machine and store it wherever I’d like (similar to the Virtual Hard Disk we just created).

image

I’ll also get a chance to specify the amount of memory (RAM) that I’d like to give the machine. With this, I have the option to use dynamic memory, a new feature included in Hyper-V when it was updated in Windows Server 2008 R2.

image

Dynamic memory is similar to having a dynamic disk in that it only allocates the amount of memory needed for the applications to run. Certain cases work great for this (ie: file and print services). However, for a development environment, strange errors can occur depending on your development style. So, since I have 16 GB of RAM in this machine, I’ll opt for carving out 2 GB when the machine is running.

The next screen allows us to configure the default network connection. Don’t worry that there’s only one option. If you have both an internal NIC as well as a wireless NIC, you’ll be able to add the additional NICs after the fact. Choose the one you are connected to now and continue.

image

The next screen allows us to choose a hard disk. Remember that since we used a fixed disk, we’ll want to choose the attach option and browse to the disk we created.

image

If we originally choose to use a dynamic disk, we’ll get additional Installation options for installing an operating system as shown below:

image

But, we didn’t, so instead we’ll continue to the Summary and choose Finish.

Once our VM is created, we’ll see it in the list of Virtual Machines on our PC. The current state of the VM will be off. One cool benefit of having Hyper-V installed is that we can Start a VM, shutdown our host, and when we power up our host, the VM will be started again without losing state. This is because Hyper-V controls the state of the VM and constantly saves that state to the same location as the VM file.

image

Before we start our VM, let’s hop into the configuration and modify it accordingly. We’ll either right-click and choose Settings or left-click once our VM name and choose Settings from the right-hand menu that is named after our Virtual Machine.

We’ll begin by adding in the other NICs. We do this by choosing Add Hardware in the list and clicking Network Adapter. Then click the Add button.

image

We can continue through the process until we have added all of the NICs that we’d like to add.

image

Before we close out of Settings, we’ll want to choose our IDE Controller and update our DVD drive to point to the appropriate ISO image or drive containing our OS installation disk. I’ll be installing a Windows 8 x64 operating system using an ISO image I have placed on an external USB hard drive.

image

While we are still in this screen, take notice to the upper left-hand corner above our settings. We don’t need to hop out of one settings window, click on another VM, and go into their settings to edit. Rather, we can navigate through all of our VMs right here. Do note, however, that if a VM is started, some settings such as the memory allocation and hardware configuration will not be available. We must shutdown the VM to make those changes. We can mount the IDE controller for our DVD drive when the VM is running.

image

Woot! We can now boot our VM. We can do this by right-clicking the VM (or using the menu in the right-hand side under the name of the VM) and choosing Start. Start boots the VM, but doesn’t show it. If we’d like to see the screen, we’ll have to then choose Connect under the same menu.

image

We’ll want to continue with our OS install as usual. Note that you will give up mouse and keyboard control for some operating systems. To gain back control on your host machine, press and hold the Alt, Control, and left arrow keys.

After your OS is done installing, there’s a really good chance you’ll want to install the Integration Services by using the VM instance Action menu and choosing the option to Insert Integration Services Setup Disk.

image

This will mount this ISO image to your DVD drive. You’ll then be able to run the setup from your operating system.

Once it’s installed and you reboot your VM, you’ll notice that you’ll now have the ability to use the VM instance Clipboard menu. The options here are to ‘Type clipboard text’ or ‘Capture screen’. Hyper-V does not support dragging and dropping files or copying clipboard items using Ctrl-C and Ctrl-V. It also does not support copying text from the VM back to the host. That is, natively. So, we now have to find a solution for this. We have a couple of options. Many technology consultants tend to recommend using a VNC server and VNC client such as RealVNC or TightVNC. In Windows 8, depending on your display adapter, you may not have the desired display settings available for the VNC client. As a result, this is the first time in many years that I’d highly recommend using Remote Desktop.

Remote Desktop from the host back to the VMs will give me fully integrated capabilities such as full screen display and copy and paste back and forth between the two machines.

On Windows 8, setting up Remote Desktop is as simple as going into Search and searching for ‘Remote Desktop’, choosing Settings, and clicking the option to Allow remote access to your computer.

image

When this opens, we’ll want to choose the radio button to Allow remote connections to this computer. We’ll also want to choose Specific Users (if on a business network) that have the ability to connect to it.

image

Then, if you’re connecting to Remote Desktop from Windows 8, search for it the same way as before, but this time leave the default Search results as Apps and choose the Remote Desktop Connection.

image

When that appears, type in the host name of your VM and you’re connected.

In summary, I walked you through the basics of setting up virtualization on Windows 8 and connecting to the VM for better integration. We talked about some caveats such as the native support for copying and pasting as well as benefits such as the “always on” functionality of your VM. I hope that this post helps clear up any issues or questions you’ve had for Windows 8 virtualization.

If there’s a topic or area that I haven’t covered here (or anywhere on my blog) that you’re interested about, leave me a comment and I’ll get to it as soon as possible.



September Tech Announcements for Apple, Microsoft, and Amazon

Wow. The next two weeks has a lot in store for us. There’s a lot that will be announced and released in the next two weeks. Let’s start with today and detail out the next 8 days:

Recently announced at IFA 2012 Berlin last week:

Upcoming beyond September 12th include: