BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

ASP.NET Programming Using Windows PowerShell

| by Abel Avram on Jul 22, 2008. Estimated reading time: 1 minute |

In an attempt to fill in an existing gap, NSoftware has made available a power shell toy, named PowerShellASP, which allows ASP.NET programmers to access the functionality of Windows PowerShell from inside ASP pages.

According to the authors, PowerShellASP is described as following:

PowerShellASP is an ASP-like template language for Web Applications; templates contain a mixture of markup (HTML, XML or whatever you want to generate) and inline PowerShell code. At runtime, templates/pages are fully translated to PowerShell code and executed as a single unit inside a PowerShell pipeline, with the results sent to the client browser.

PowerShellASP runs off the ASP.NET platform, implemented as a custom IHttpHandler mapped to *.ps1x files. Because of this, you can mix PowerShellASP pages alongside any ASP.NET application. This provides a great way to leverage PowerShellASP inside your existing applications as needed or you can create complete applications from scratch based only on *.ps1x pages.

In PowerShellASP, the usual Hello World example looks like this:

<html>

   <body>
      <hl>Hello <%= $request['name'] %>!</hl>
   </body>
</html>

A page which displays the running processes on the machine looks like this:

<html>
  <body>
    <table>
      <tr><td>ID</td>><td>Name</td></tr>
      <% get-process | %{ %> 
        <tr>
          <td><%=$_.ID%></td>
          <td><%=$_.ProcessName%></td>
        </tr>
      <% } %>
    </table>
  </body>
</html>

The PowerShellASP can be downloaded free of charge under the PowerShellASP license.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Cool, but... by Kurt Christensen

Well, I'm sure *that* won't lead to any security holes.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT