Configuration Specific Web.Config in Visual Studio 2010

by Admin 30. July 2010 05:03

A cool feature of Visual Studio 2010 is the ability to have configuration files that are build configuration specific. Handling build configuration specific config files was always a challenge in the past where one had to store multiple config files for a dev environment versus a staging environment versus a production environment.

For example, a dev environment specific conf file would store the connection string to your dev database and the production envirnment web.config would store the connection string to your production database. Now when you moved your code between environments, you would have to make sure that the correct config file is copied over and that your production environment code is not accidentally pointing to your dev database.

This problem is solved by visual studio 2010 that allows cbuild configuration specific config files. In VS 2010, whenever you create a new web application project now, you'll see that your web.config in your solution explorer actually appears as an expandable node. When you expand it, you will see multiple configuration files for each of your build configurations, that can hold different values for each configuration.

Now when you build your application in a specific build configuration, the correct web.config settings get applied. Similarly when you publish, the correct web.config settings get published.

Tags: , , ,

ASP.Net | VseWss 3.0 v1.3

.LESS Dynamic CSS for .Net

by Admin 11. March 2010 13:13

If you haven't checked out the .LESS project already, check it out: http://www.dotlesscss.com/

.LESS is an open source implementation and port of Ruby's LESS Library, for .Net. It allows for the dynamic creation of cascading style sheets. Using less you can define dynamic style sheets that can have variables, operations, mixins and nested rules. It has great cachin features as well.

for a good article on improving CSS development using .LESS, check out the .LESS project website or this article by Scott Mitchell at http://www.4guysfromrolla.com/articles/030310-1.aspx

Tags: , , ,

.NET | ASP.Net

Periodically update webpage with server data - Simulate pushing data from server to client

by Admin 2. February 2010 04:23

JavaScript has a function, setInterval(code, timeout) that can be used to periodically update a visitors web browser. Using this feature you could simulate pushing updates from the server side to the clients browser using AJAX.

The setInterval(<code>, <timeout>) function call takes 2 parameters. <code> which is the javascript call to run and <timeout> is the interval at which to periodically make that call. The call specified as the <code> parameter can be an AJAX call to fetch the data and update the browser part.

function pageLoad(sender, args) { 
   setInterval('UpdatePage();', 2000); 
}

For example, the above  javascript function can be set to run on page load, which in turn will call the UpdatePage() Javascript call every 20 seconds.

for a complete example, take a look at the 4 guys site @ http://aspnet.4guysfromrolla.com/articles/012109-1.aspx

Tags: , , ,

.NET | Ajax | ASP.Net | JavaScript