Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

Ironpython asp by bestt571

VIEWS: 13 PAGES: 4

The predecessor of ASP ASP.NET technology, first introduced in IIS 2.0 on (Windows NT 3.51), was launched together with the ADO 1.0, in IIS 3.0 (Windows NT 4.0) to flourish and become a popular server-side application development tools, Microsoft it is also tailored specifically for the Visual InterDev development tools in 1994 to 2000, ASP technology has become a Microsoft Windows NT 4.0 platform to promote one of key technologies, tens of thousands of ASP website also began at this time as mushrooming in the network. It's simple and highly customizable capabilities, but also one of the reasons it can rise quickly.

More Info
									                                                IRONPYTHON ASP.NET INTEGRATION IRONPYTHON

IronPython Asp.NET Integration

One of the IronPython development area is Asp.NET. In this article we will see Visual Studio 2008 Asp.Net
integration.

First check out the features of Asp.NET http://www.asp.net/downloads/futures/default.aspx and
ASP.NET Dynamic Language Support

Then download the Asp.NET IronPython integration for visual Studio 2008 installer
 http://www.microsoft.com/downloads/details.aspx?FamilyId=A5189BCB-EF81-4C12-9733-
E294D13A58E6&displaylang=en




Asp.NET with IronPython is really rocks! This combination gives us time/performance advantage. Especially in
small scripts for events, python code is too short and powerful! So we can prototype projects quickly.

Because of Dynamic Language, it will work on client’s machine and it works dynamicly. With this feature we can
connect websites faster.




                   |İbrahim KIVANÇ
                   |ik@ibrahimkivanc.com
                   |www.ibrahimkivanc.com
                                                                                                                 1
                                                   IRONPYTHON ASP.NET INTEGRATION IRONPYTHON

Let’s check out, files in a project from Solution Explorer.


           IRONPYTHON                                            C#




After creating a new web project, “bin” folder, "default.aspx" page, "Global.py" file and "Web.config" file are
created by Visual Studio.

"bin" Folder
It contains our website DLLs for running IronPython on the web.

Default.aspx
It’s our default homepage for web project. It work with code-behind file, Default.aspx.py which contains all
python code for page.

Global.py
This file contains some situations about web application for some cases.

def Application_Start():
    ' Code that runs on application startup'
    pass

def Application_End():
    ' Code that runs on application shutdown'
    pass

def Application_Error(app, e):
    ' Code that runs when an unhandled error occurs'
    pass




                    |İbrahim KIVANÇ
                    |ik@ibrahimkivanc.com
                    |www.ibrahimkivanc.com
                                                                                                                  2
                                                   IRONPYTHON ASP.NET INTEGRATION IRONPYTHON

def Application_BeginRequest(app, e):
    ' Code that runs at the beginning of each request'
    pass

def Application_EndRequest(app, e):
    ' Code that runs at the end of each request'
    pass

web.config
Some Asp.NET web project configurations included in it.

What is the differences between “C# Asp.Net” and “IronPython Asp.Net”?
First differences In Ipy Project, it contains “bin” folder which contains DLL libraries for IronPython and global.py
file.

The most helpful advantage of IronPython is easy and short code. Usually people compare C# and IronPython
with their code line.

Let’s check out the example below

The web page contains label and a button. First page initialize button text as “Click” and Page title as
“IronPython Example” on Page Load. After clicking button, label text will be “Clicked” on Button1 Click.


C#

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Button1.Text = "Click!";
        this.Page.Title = "C# Example";
    }

      protected void Button1_Click(object sender, EventArgs e)
      {
          Label1.Text = "Clicked";
      }
}


IronPython

def Page_Load(sender, e):
    Button1.Text = 'Click'
    Page.Title = 'IronPython Example'

def Button1_Click(sender, e):
    Label1.Text = 'Clicked'




                    |İbrahim KIVANÇ
                    |ik@ibrahimkivanc.com
                    |www.ibrahimkivanc.com
                                                                                                                       3
                                                IRONPYTHON ASP.NET INTEGRATION IRONPYTHON




Also in IronPython we don’t have to import standard libraries. Now Programming is really enjoyable! :)

If you have any questions or discover any errors / typos please let me know ik@ibrahimkivanc.com

All The Best!




                   |İbrahim KIVANÇ
                   |ik@ibrahimkivanc.com
                   |www.ibrahimkivanc.com
                                                                                                         4

								
To top