Thursday, January 13, 2011

How to update Web.config dynamically?

I need to update web.config dynamically? So this is what I did, this code below has done the trick for me.

string value = "webmaster@company.com";
Configuration config = webConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appsetting = config.GetSection("appSettings");
appsetting.Settings("fromAddress").Value = value;
config.Save();
Make sure to add System.Web.Configuration in the namespace. Have fun Light bulb

Thursday, January 06, 2011

assemblyBinding: Using Shared DLLs in .NET

How to Share DLLs in VS 2010. Recently I and my team had a problem working with a Shared DLL. Our developers are saving our project in different locations of our computer. Few are saving in D drive and few in E drive. So while getting latest solution from the Visual source safe some of us are having missing references problem with the DLLs when we have Shared DLLs in a location. So to resolve this we have created a folder in *\bin folder with name Shareddlls and placed all the Shared dls in that folder.

Once we have done this we need to add piece of code in web.config.

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin/shareddlls" />
    </assemblyBinding>
  </runtime>

This worked perfectly for me. Microsoft rocks. When I first read that .NET assemblies could be "redirected" at runtime, I was stunned and a little bit suspicious. By using Assembly Binding Redirection you can redirect an assembly binding reference to another version of an assembly by using entries in the application or machine configuration files. You can redirect references to .NET Framework assemblies, third-party assemblies, or assemblies of your own application. Each version of the .NET Framework has a machine configuration file, and any redirection information in that file affect all applications running under that version of the .NET Framework.


Redirecting .NET Framework Assembly Binding


The .NET Framework assembly unification model treats all .NET Framework assemblies of a given version, and the runtime of that version, as a single unit. The redirections that occur with this model are the default behavior for the runtime.
There are several ways to instruct the runtime to load a .NET Framework assembly with a different version than that of the loaded runtime:



  • Add settings in the application configuration file.

  • Add settings in the machine configuration file.

  • Create a publisher policy file that is distributed with a component to specify which assemblies a component should use.

A binding redirection in an application configuration file for a unified .NET Framework assembly cancels the unification for that assembly. To redirect an assembly binding reference for an assembly that is not part of the .NET Framework, specify the binding redirection information in the application configuration file using the <assemblyBinding> element.

SQL Server AZURE code-named "Denali" is ready for Download

Microsoft SQL Server code-named “Denali” empowers organizations to be more agile in today’s competitive market. Customers can efficiently deliver mission-critical solutions through a highly scalable and available platform. Industry-leading tools help developers quickly build innovative applications while data integration and management tools help deliver credible data reliably to the right users and new user experiences expand the reach of BI to enable meaningful insights. It provides a highly available and scalable platform with greater flexibility, ease of use, lower TCO, and the performance required by the most mission-critical applications.

Top SQL Azure Features:

  • No software to install or hardware to set up.
  • High availability and fault tolerance.
  • Simple provisioning and deployment.
  • Frictionless application development.
  • Scalable databases based on business needs.
  • Multitenant support.
  • Integration with Microsoft Visual Studio.
  • Transact-SQL development support.
  • Familiar, relational database model.
  • ADO.NET, OBDC, JBDC, PHP, and OData support.

Download free trail from here.

Friday, December 31, 2010

New Year Eve : 2011

Wish you happy new year to you and your family. Hope you all have a wonderful and loving year. Welcome to Year 2011.

Thursday, December 30, 2010

Skype Adds Video Calling to iPhones, iPad, iPod touch

Skype today announced that the new version of its iPhone application adds video call support, allowing users to make video calls over 3G and Wi-Fi networks. This means that users of the iPhone, iPad, and iPod touch are now able to make and/or receive free video calls with one another, as well as with anyone else running Skype software that supports video calling.