can I progarmatically register asp.net to IIS

Discussion in 'ASP .Net Web Services' started by chandan, Mar 19, 2008.

  1. chandan

    chandan Guest

    Hi,
    I am using aspnet_regiss.exe utility from command prompt to register
    asp.net to IIS. But my requirement is to do it programmatically so
    that client need not worry about this registration. Can we do this
    programmatically??

    Thanks
    Chandan
     
    chandan, Mar 19, 2008
    #1
    1. Advertising

  2. 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

    --
    David R. Longnecker
    http://blog.tiredstudent.com

    > Hi,
    > I am using aspnet_regiss.exe utility from command prompt to register
    > asp.net to IIS. But my requirement is to do it programmatically so
    > that client need not worry about this registration. Can we do this
    > programmatically??
    >
    > Thanks
    > Chanda
     
    David R. Longnecker, Mar 22, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Davis
    Replies:
    3
    Views:
    603
    Jon Davis
    Jun 21, 2007
  2. chandan
    Replies:
    1
    Views:
    552
    Cowboy \(Gregory A. Beamer\)
    Mar 19, 2008
  3. chandan
    Replies:
    2
    Views:
    424
    Teemu Keiski
    Mar 19, 2008
  4. Icon Iconoclast
    Replies:
    4
    Views:
    1,567
    bruce barker
    Nov 14, 2008
  5. chandan

    can I progarmatically register asp.net to IIS

    chandan, Mar 19, 2008, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    151
    Murali
    Mar 20, 2008
Loading...

Share This Page