
What is the purpose of bindingRedirect tag in web.config file of .NET?The tag bindingRedirect
has its significance when multiple versions of an assembly persist in
GAC and you have to choose which version to actively use. Assume that
your application is using a DLL which is put up in GAC. However,
.NET gives you a provision to choose whichever version of DLL you want
to refer while executing your application. This customized behavior can
be achieved in .NET by specifying the bindingRedirect tag in web.config
file. This tag has two attributes namely new version and old version.
Whichever version is specified in the new version attribute will be binded
to your application at run time. Here is a snippet from web.config file
to give you an example of this tag: <bindingRedirect
oldVersion="2.0.0.1" </dependentAssembly> In this snippet
of web.config file, you have configured runtime configuration settings
for an assembly named sampleAssembly. This assembly has two versions namely
1.0.1.1 and 2.0.0.1. From the version numbering, it is clear that 1.0.1.1
is the older version and 2.0.0.1 is the latest version. But you want 1.0.1.1
to be binded to the application and not the latest version. To achieve
this, you introduce the bindingRedirect tag and specify the oldVersion
attribute value to be the actual latest version namely 2.0.0.1 and specify
the newVersion attribute value to 1.0.1.1 which is the first version of
the assembly that is created. At run time,
CLR will look at the configuration settings and fetch the newVersion value
of bindingRedirect tag and use 1.0.1.1 as the version to be refered in
GAC while executing the application.
_______________________________________________________________________
FREE
Subscription
Subscribe
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ |