I need to develop a web-based map using existing shapefiles.
Using the web-map, we must be able to select a region and produce contours for that selected region.
Can any one suggest the best open source solutions for this?
What do you mean by 'generate contours'? Do you have contours as shapefiles and want to display for the selected area only. That can be achieved using OpenLayers CQL filters. If this is not the case, what elevation data do you have? In case you are using DEM, you can check this link : Developers Corner: have your SLD transform raster data into vectors on the fly.However I have never used this approach.
My guess is, you are having a polygonal (regions) shape file and few contour shape files. On a particular zoom level, you want to display the contours, right ?
There are n number of open source /free map server available to achieve this.