I want to set a Windows Environment Variable for my whole user login session

Use setx to permanently set an environment variable

If you've used windows environment variables at all, you've probably wished you could set them in a command window for use in another program.
You can't change the environment of an already-running program - the environment is copied when a program starts - but you can set environments values for your user session that will be picked up by any new programs you launch with setx:

setx myvariable thenewvalue

Much easier than right-clicking to get to My Computer properties.
setx /? will also tell you about setting permanent, machine-wide and remote machine environment values.

setx comes with Windows 7 or in the Windows Resouce Kit.

How to unset a variable set with setx

setx myvariable ""

See http://support.microsoft.com/kb/195050 for more details.

Asp.net / IIS7 : System.BadImageFormatException: Could not load file or assembly

You have something like this:


Server Error in '/Vendorapplication' Application.
Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

It's because you are trying to run 32 bit dlls on a 64 bit system. Fix it in IIS manager by changing the advanced settings on you application pool to enable 32 bit applications. Or create a new app pool specifically for them.

Alex James Brown has a nice picture: change app pool to 32 bit

There is a duplicate system.web.extensions/scripting/scriptResourceHandler section defined

Scenario:
You've been working with no problems probably in VS2008 on web app written on .net 2 or .net 3.5 or .net 3.5 sp1 and then you try running on a machine with windows 7 or vista running IIS7 and you get this error message...
Simples. It's comes of running your .Net 2 (you did know that a .Net 3.5 app actually runs on .Net 2 didn't you?) app under .Net 4. Fix it by changing the app pool for your web app to the pre-defined "Classic .Net App Pool", which runs .Net framework 3
Run a dotNet 2 or dotNet 3 or dotNet 35 app under IIS7