Problems getting Forms Authentication to work with a child MVC application

Recently we had an issue where we were trying to create an MVC (I think MVC5) web app that was going to be a virtual application off of a parent .net webforms application. By this I mean that the root of the site was a webforms app, and the new MVC app being created was ~/Whatever.

We were having some problems getting the authentication ticket from the parent site to work in the new MVC app. Both sites were running under the same app pool. We had other apps running the same way without problem. What was the issue?

Well, I believe it turned out to be that the MVC app specified .net 4.5 in it’s web.config file, while the root application was running with .net 4.0. The problem line was:

<httpRuntime targetFramework=”4.5″ />

As soon as we removed that line from the web.config it started working.

This stackoverflow post seems to suggest the same thing (not the answer with 3 upvotes, the one with 26).

It says:

If your forms authentication ticket needs to be shared between applications using an older version of the .NET framework, you must explicitly configure your .NET 4.5 apps to use the earlier machine compatibility modes, or they will not be able to encrypt/decrypt the forms authentication ticket.

In your .net 4.5 application’s web.config, set the compatibility mode attribute:

<machineKey compatibilityMode=”Framework20SP2″ />

This will allow your .NET 4.5 apps to work with forms authentication tickets generated by earlier .NET versions.

Note: If any of your servers do not have .NET Framework 2.0 SP2 installed, you will need to set the compatibility mode to “Framework20SP1″ instead.

We didn’t do this exact same fix, we just removed the one line from the new webapp’s web.config, but it sounds like the same problem.

Trying to use more than 1 WD “My Book” external drives?

I ran into a problem with a client today where we were trying to add some USB external storage for added onsite backup storage. The problem was, it never seemed to show more than 1 of the 2 external drives.

I tried the 2nd drive that wouldn’t show up on other machines, and it worked fine.

Turns out the problem exists in more recent version of windows. This happened on Server 2012. If 2 devices are connected, it will only assign 1 of them a drive letter if they have identical signatures.

WD My Book hardware ID collision

This explains the fix using diskmgmt:

Log Parser Lizard

Recently I’ve been working a bit with Log Parser Lizard and it’s been very helpful.

You can take log files, import them, pick the expected format, and then query them in a SQL style manner.

So for example, I took a bunch of IIS log files and was able to easily run this query against it:

FROM 'C:\Users\Chris\Downloads\www-logs\*.log'
where sc-status = 404 and cs-uri-stem <> '/AzureFileHandler.ashx'
and cs-uri-stem <> '/js/jquery.1.11.1.min.js'


Pretty cool


IE11 Dev Tools (F12) Will Prevent HTTP 304

If you happen to be working on testing your client side caching of things like images and JS files, you might be banging your head against a wall wondering why you are not seeing any HTTP 304s being sent while analyzing the network traffic with the IE F12.  Those tools apparently suppress the browsers ability to cache these files, most likely to aid people who are debugging javascript from trying to understand why their changes aren’t being seen.  If you look at the Fiddler image below, you can see I loaded a site, which resulted in mostly 304s.  I then opened F12 in IE and reloaded the same site, and from that point on it avoided its cache and downloaded all the files.


Shrink your SQL Server Log Files (LDFs)

If you just want to shrink your log files, you can use the following code, but make sure to replace DBName with whatever your real database name is.

DBCC SHRINKFILE( 'DBName_log',1000 )

If by chance your log file isn’t named DBName_log, you can find out what the actual name is by using this bit of code:

FROM sys.database_files
WHERE type_desc = 'LOG'

SQL Server Report Builder Error “Cannot Retrieve Application. Authentication Error”

I found myself unable to use the Report Builder from the SSRS web app today with the error “Cannot Retrieve Application. Authentication Error.”

Turns out, even if you supply the right credentials when you login to the site, those credentials are not used when launching the Report Builder, only your local current windows credentials are.

So, you need to add your SSRS credentials to your local windows credential cache. To do this:

Go to User Account in Control Panel and pick your account (or just search for Manage Network Passwords)
Select Manage Network Passwords
add an entry in the Windows (not Web) section
put in the name of the report server, you might need to do both the machine name and the FQDN
put in the user and password you use to login

That solved my problems.

Calculating Returns on Flipping a House vs Renting vs Investing in Stock

My parents and I have purchased a house that we (mostly through the work of my mom honestly) are renovating.  The project is practically finished and we are at the decision point of asking ourselves: do we sell the house or do we rent it out?

There are a ton of factors to consider:

1) How much could we sell the house for?

2) How much rent could we get for it?

3) If we sell now we will pay tax on the profit at our marginal tax bracket rate (28% most likely)?

4) If we rent it out, how much value will be lost by selling the house later when it’s not in pristine condition that it is now?

5) How much will this area appreciate in value over the next X years?

6) How much will property taxes increase?

7) How much money will we need to invest to maintain the property?

8) What type of return on investment would we be realizing if we didn’t buy the house and just stuck our money in the stock market?

9) If we flipped the house and the invested the proceeds for the next X years, how would that compare with renting the house over those years?

These are just the tip of the iceberg.  Obviously there is no way that we can identify all these values and know all these answers, but in order to try to improve my understanding of the issue, I’ve created a fairly detailed excel file to analyze as many data points as I could think of when it comes to answering: Should I buy this house and fix it up or invest my money elsewhere, and if investing in the property makes sense, should we rent it or flip it?

I’m not an expert at any of this, so take my excel file and its calculations with a grain of salt.  If anyone notices something I’ve done wrong I’d be interested to know so I can update the excel document with more accurate information.

Rent vs Flip Calculations Template Excel Document