Chandan-
You could create a simple command file that the client (or you) run on installation
(or build it into your deployment package).
%windir%\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -i
I suppose you could also do something using the System.Diagnostics.Process
class and create a little Console executable, but this might a bit of overkill.
Remember, simple (hence, a command file), is good.
If you want a console file to ask for input, etc or have other tasks, here's
a quick example using your aspnet_regiis.exe file:
// Create a new Process object.
Process registerProcess = new Process();
// Assign the aspnet_regiis.exe file to the process.
registerProcess.StartInfo.FileName =
System.Environment.GetEnvironmentVariable("windir") +
@"\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe";
// Pass along the -i parameter (install)
registerProcess.StartInfo.Arguments = @"-i";
// Simply return the output to the same calling command window.
registerProcess.StartInfo.RedirectStandardOutput = false;
registerProcess.StartInfo.CreateNoWindow = false;
registerProcess.StartInfo.UseShellExecute = false;
// Start the process.
try
{
// Start the process.
registerProcess.Start();
}
catch (Exception ex)
{
throw;
}
finally
{
registerProcess.Dispose();
}
Hope this helps!
-dl