Project DescriptionWhat if your website had a full fledged scripting language embedded inside it? IronConsole is based on the DLR(C#/IronPython) and allows you to script your app at runtime via a browser console. Useful for quick debugging,querying/modifying session/context/singletons at runtime.
Screenshotshttp://ironconsole.codeplex.com/documentationSince IronConsole runs under the same appdomain as your website, IronConsole has access to the current HttpContext and hence the ASP.NET session as well. And any other global objects in your appdomain.
Current supported DLR (
0.91) language is
IronPython,
IronRuby. Type in #python or #ruby to switch between the languages.
InstallAdding IronConsole to an existing ASP.NET site is just a simple matter of dropping a few files under the website root.
You don't have to write any code or modify your application.
Just download the release,
IronConsoleInstaller.zip and do the following:
- Copy the files in bin to the bin of your website.
- Copy the ScriptConsole folder to the root of your website.
- Access the ajax version at http://localhost/yourwebapp/ScriptConsole/IronConsole.aspx! This is the recommended entry point.
- Access http://localhost/yourwebapp/ScriptConsole/SplitConsole.aspx or http://localhost/yourwebapp/ScriptConsole/console.aspx for a non-ajax version.
Note: You really don't have to know IronPython/IronRuby to use this app, something like
Session["Name"] = "Aroj" or ShowCookies() is the kind of simple commands that you will mostly be using. And yes, if you are a python/ruby ninja, then rock on!
Objects available at the console:
- session :- the session object.
- context :- HttpContext.Current
- identity :- HttpContext.User.Identity
- System :- the system namespace has been auto-imported. So you could just go print System.DateTime.Now without having to do import System in python
- or p System::DateTime.Now without having to do a 'require' on System in ruby.
Python functions available at the console:
- ShowCookies()
- ShowSession()
- pdump() :- Reflects over an object and prints the values of all properties one level deep.
Besides the above, since you have full access to the entire .NET framework, you could simply add a reference to any dll and import it into the console, like below,
clr.AddReference('<dll name>')
import <namespace>
Ruby functions available at the console:
- None as of now, work in progress...but you can ofcourse write your own in the script window.
Script ExtensionsYou can extend the console by adding your own scripts under the
ScriptConsole\Scripts\Default or the
ScriptConsole\Scripts\UserDefined folders.
Note that as of now only python scripts are being loaded, need a way to configure ruby scripts as well.
TODO:
- Dynamically load .NET dll extensions as well.
- Ajaxify the execute script/command and avoid the post backs... done! (release 0.5)
- Make things more secure.
Short Python TipsThanks To:
- http://blogs.msdn.com/jmstall/archive/2005/09/01/Howtoembedironpython.aspx :- The inspiration behind the idea.
- http://blogs.msdn.com/hugunin/ :- Father of IronPython :-)
Note: IronConsole is not intended for production use or to allow end users to script the application. Atleast not yet! The current use case is more for development time debugging/playing around/tinkering/learning etc..Specially useful in environments without Visual Studio installed like your QA environment for e.g.