How to interact with mainframe from asp net web pages c


ASP.NET is a popular programming language used for developing web applications. One common requirement in web development is the need to interact with mainframe systems. In this article, we will explore different ways to interact with mainframe systems from ASP.NET web pages.

Using IBM Host Integration

IBM Host Integration Server is a software product that enables integration between Windows and IBM mainframe systems. It provides various components and tools to facilitate between the two platforms.

To interact with mainframe systems from ASP.NET web pages using IBM Host Integration Server, you can use the IBM.Data.DB2.iSeries namespace. This namespace provides classes and to connect to and interact with DB2 databases on IBM iSeries (AS/400) systems.

using IBM.Data.DB2.iSeries;

public void ConnectToMainframe()
    iDB2Connection connection = new iDB2Connection("DataSource=mainframe;UserID=user;=password");
    // Perform mainframe operations

In the above example, we create an instance of the iDB2Connection and provide the necessary connection details, such as the data source, user ID, and password. We then open the connection and perform the desired mainframe operations. Finally, we close the connection to any resources.

Using Web Services

Another way to interact with mainframe systems from ASP.NET web pages is by using web services. Web services provide a standardized way to communicate between different platforms and technologies.

To interact with mainframe systems using web services, you can create a web service on the mainframe side that exposes the required functionality. You can then consume this web service from your ASP.NET web pages.

using System.Web.Services;

[WebService(Namespace = "")]
public class MainframeWebService : WebService
    public string GetMainframeData()
        // Retrieve data from mainframe
        return "Mainframe data";

In the above example, we create a web service called MainframeWebService that exposes a called GetMainframeData. This method retrieves data from the mainframe and returns it as a string.

To consume this web service from your ASP.NET web pages, you can use the Service Reference in Visual Studio. This feature generates proxy classes that allow you to easily call the web service methods.

using MainframeWebServiceReference;

public void ConsumeMainframeWebService()
    MainframeWebServiceClient client = new MainframeWebServiceClient();
    string mainframeData = client.GetMainframeData();
    // Process mainframe data

In the above example, we create an instance of the MainframeWebServiceClient class, which is a proxy class by Visual Studio. We then call the GetMainframeData method to retrieve the mainframe data and process it as needed.


Interacting with mainframe systems from ASP.NET web pages can be achieved using various approaches. In this article, we explored two common methods: using IBM Host Integration Server and using web services. Depending on your specific requirements and the capabilities of your mainframe system, you can choose the most suitable for your project.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents