Friday, July 8, 2011

Changing the ASP.NET Version of a Site Running on IIS6

Later Edit : please read the end of the section
If you attempt to change the ASP.NET version used by a website from the Internet Information Services (version 6)Manager, you will receive a warning message similar to the following:
Changing the Framework version requires a restart of the W3SVC service.  Alternatively, you can change the Framework version without restarting the W3SVC service by running: aspnet_regiis.exe -norestart -s IIS-Virtual-Path
Do you want to continue (this will change the Framework version and restart the W3SVC service)?
So what is the process for upgrading a site without restarting the W3SVC service and stopping all of the sites running on the server?
First, log on to the web server.
Next, open a command prompt and navigate to the folder for the framework that you wish to target, which is located within the OS folder (typically, the "Windows" folder on the C: drive).  For this example, we’ll assume you are upgrading to ASP.NET 4.  So, navigate to C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319.
Run the "aspnet_regiis -lk" command to get a list of web site instances running on the server.  The results of the command will look something like the following:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk
W3SVC/  1.1.4322.2470
W3SVC/1177368573/root/  2.0.50727.3053
W3SVC/1292709509/root/  2.0.50727.3053
W3SVC/136133328/root/   2.0.50727.3053 
W3SVC/147603420/root/   4.0.30319.0
W3SVC/1724783696/root/  4.0.30319.0
W3SVC/393926990/root/   2.0.50727.3053
W3SVC/436374705/root/   2.0.50727.3053
W3SVC/44648490/root/    4.0.30319.0
W3SVC/44648490/root/maps/       2.0.50727.3053
W3SVC/462046935/root/   4.0.30319.0
W3SVC/583520931/root/   4.0.30319.0
W3SVC/583520931/root/alertmsg.txt/      4.0.30319.0
W3SVC/707791973/root/   2.0.50727.3053
W3SVC/886194175/root/   2.0.50727.3053
W3SVC/95358537/root/ImageWeb/   2.0.50727.3053
Notice that each line lists a web site instance name and the version of ASP.NET used by that instance.  (The highlighted line in the example output represents the site we will be upgrading.)
Open the Internet Information Services Manager on the server and select the "Web Sites" node, as shown here.
IISMgr 
Find the site you want to upgrade in the right-hand pane of the IIS Manager and note the value in the "Identifier" column.  Match that value to the instance names returned by the "aspnet_regiis -lk" command.  In our example, we are going to upgrade the site with an identifier value of "136133328", which we can see in the aspnet_regiis output has an instance name of "W3SVC/136133328/root/".
Run the "aspnet_regiis" command with the "-s" and "-norestart" arguments, as shown here:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -s W3SVC/136133328/root/ -norestart
Start registering ASP.NET (4.0.30319) recursively at W3SVC/136133328/root/.
Finished registering ASP.NET (4.0.30319) recursively at W3SVC/136133328/root/.
Once this command completes, use the IIS Manager to recycle the application pool for the site. 
The site has now been upgraded.
You can now re-run the "aspnet_iis -lk" command to verify that the ASP.NET version has changed.  For example:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lk
W3SVC/  1.1.4322.2470
W3SVC/1177368573/root/  2.0.50727.3053
W3SVC/1292709509/root/  2.0.50727.3053
W3SVC/136133328/root/   4.0.30319.0 
W3SVC/147603420/root/   4.0.30319.0
W3SVC/1724783696/root/  4.0.30319.0
W3SVC/393926990/root/   2.0.50727.3053
W3SVC/436374705/root/   2.0.50727.3053
W3SVC/44648490/root/    4.0.30319.0
W3SVC/44648490/root/maps/       2.0.50727.3053
W3SVC/462046935/root/   4.0.30319.0
W3SVC/583520931/root/   4.0.30319.0
W3SVC/583520931/root/alertmsg.txt/      4.0.30319.0
W3SVC/707791973/root/   2.0.50727.3053
W3SVC/886194175/root/   2.0.50727.3053
W3SVC/95358537/root/ImageWeb/   2.0.50727.3053
Notice that the ASP.NET version associated with the upgraded site has changed from 2.0.50727.3053 to 4.0.30319.0.
IMPORTANT:  I think this should go without saying, but I’ll mention it just in case.  Make sure that you have made all of the necessary changes to your application and/or your application’s configuration to ensure that it will run correctly on the newly-selected version of ASP.NET.

There are situation when you are unable to find the site because theare are much more.
The solution will be iisweb command.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>iisweb /query test_site
Connecting to server ...Done.
Site Name (Metabase Path)                     Status  IP              Port  Host
==============================================================================
test _Site(W3SVC/1061845049)                    STARTED ALL             8081  N/A

W3SVC/1061845049

Now you can use the id of the site for registering 


Thursday, July 7, 2011


Re: how to clear validation summary?


function HideValidationSummary(){ 
if (typeof(Page_ValidationSummaries)!= "undefined"){ //hide the validation summaries
            for (sums = 0; sums < Page_ValidationSummaries.length; sums++) {
                summary = Page_ValidationSummaries[sums];
                summary.style.display = "none";
            }
        }

Hide Validator Error Message Using Javascript

function HideValidators()
 
05{
06   if (window.Page_Validators)
07     for (var vI = 0; vI < Page_Validators.length; vI++)
08     {
09        var vValidator = Page_Validators[vI];
10        vValidator.isvalid = true;
11        ValidatorUpdateDisplay(vValidator);
12     }
13}
source : http://forums.asp.net/t/1035309.aspx/1?how+to+clear+validation+summary+
source : http://yasserzaid.wordpress.com/2009/06/06/hide-validator-error-message-using-javascript/
source :