Just another tech site

C# Async Webservice Call


IN an ASP.NET codebehind page

protected void ImageButton_test_Click(object sender, ImageClickEventArgs e)
{
    try
    {
        TANITWS_Log TNTWS = new TANITWS_Log();
        TNTWS.Url = ConfigurationSettings.AppSettings["TANITLOG.TANITWS_Log"];
        TNTWS.LogTestCompleted += new LogTestCompletedEventHandler(this.TestLogCallBack);
        TNTWS.LogTestAsync();
    }
    catch (Exception Ex)
    {
        this.Label_conection_info.Text = Ex.Message + "" + Ex.InnerException;
    }
}

// The Callback handler
void TestLogCallBack(object sender, LogTestCompletedEventArgs args)
{
    try
    {
        // Display the reutrn value
        if (args.Result.Length > 0)
        {
            //OK
        }
    }
    catch (Exception Ex)
    {
        this.Label_conection_info.Text = Ex.Message + "" + Ex.InnerException;
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

%d bloggers like this: