Showing posts with the label XML

Aspnet: legacyHMACWarning

Stumbled across this bad boy in the webconfig in an old project and was curious what it's purpose was. Since the comments didn't really help and I spent some time on to uncover its secrets.
"This prevents the Windows Event Log from logging the HMAC1 that is being used (when 
the other party needs it).When targeting ASP.NET MVC 3, this assemblyBinding makes MVC 1 and 2 references relink to MVC 3 so libraries such as DotNetOpenAuth that compile against MVC1." The comments don't really help, in fact only rises more quesitions. Why is the DontNetOpenAuth ever compiling against MVC1?

DotNetOpenAuth with MVC 4.0 - "Yes, DNOA is built against MVC 1.0, and this is by design so that it works against all versions of MVC (given the appropriate redirects). This is purely an MVC version thing -- not a .NET 4.0 thing"

HMACSHA512 Class (System.Security.Cryptography)

Create Custom Webconfigs in Asp.Net MVC

Here are some highlighted notes on creating a custom web-config, that I wrote after finding a very quick and easy solution to. Overall the process is very easy to get started just I felt pictures were needed because the solution I found lacked any.
Without editing, and by default MVC comes with a Debug and Release config but since I like to create a QA stage for my configurations with all my application another webconfig needs to be added.
Now right click on the project solution and go to properties, this will bring up the configuration manager. You can also just click on the build tab shown in the second image below.

Under the configuration tab and inside the dropdown simply select "New" and add in your custom Config name, for this article I just name mine example.Important keep the leave the "create new project configurations" check." If not checked you will not be able to Add the webconfig later and will have to remove it and add the config again…

Inheriting Apps with MVC

While cleaning up some code in the webconfigs of an MVC application I came across a line of code to which I had no knowledge of and even more so was showing up as an error.  I asked myself was it's purpose and most of all why was the Intellisense saying "The 'inheritInChildApplications' attribute is not allowed."?

How do I allow all users access to one route within a website with integrated auth? - Stack Overflow
Changing ASP.NET web.config inheritance when mixing versions of child applications - Scott Hanselman

All the information can be seen and found in the following links but after looking at the comments you will find the reason behind the shown error. "Be aware that the inheritInChildApplications attribute is not part of the web.config schema (even in VS 2012) so you will get blue squiggles under it with a message of "The 'inheritInChildApplications' attribute is not allowed." It will, however, work correctly… MVC4 - Bundling and Minification

While this article may be very simple and straightforward, there are a few concepts here I think are important to note. In my next article will be looking more in depth on the idea of creating a customized Web.config, but for now with this article, I just want to look at activating the bundling and minification feature by using the xml tags inside a MVC's Web.config. This feature is only available in ASP.NET 4.5 and above.
The First Problem
With the following inside your Web.config... (transform is with a Captial T.)
And with either of the following inside your build config or customized Web.config (I.E. Web.Release.config)
This also can be achieved by doing the following...
     In both snippets of code you do not need to use the "xdt:Locator" attribute (used only in cases where there are multiples elements of the same name .  What you may not see is that in the Web.config we have the "location" tag wrapped around the "system" tag. This is important …