Example on how to post a topic using the SharpLeech Engine. You can get the .dll by downloading SharpLeech and add a reference to it in your project.

You'll need these namespaces:
PHP Code: 
using System;
using System.Net;
using Hyperz.SharpLeech.Engine;
using Hyperz.SharpLeech.Engine.Net
The example (read the comments):
PHP Code: 
// our login details
string username "name";
string password "****";

// the topic that we will post.
// The last argument (2) is the forums section id
SiteTopic topic = new SiteTopic("The title""the [b]content[/b]"2);

// Setup the object that we will use to post the topic
SiteType forum DefaultSiteTypes.ByName("IP.Board 3.x.x").CreateInstance();
            
// forum url
forum.BaseUrl "http://path.to/forum";

// Attach an event handler to the login event
// We'll use lambda expressions - quick 'n easy
forum.Login += (sendere) =>
{
    
// did we actually login?
    
if (e.LoggedIn)
    {
        
// yes we did
        // now collect the data needed to create a new topic
        
forum.MakeReady(topic.SectionId);
    }
};

// Now attach an event handler to the ReadyChanged event
// This event fires when all needed 'new topic' data has been collected
forum.ReadyChanged += (sendere) =>
{
    
// are we really ready?
    // collecting the data can fail so we need to double check
    
if (forum.IsReady)
    {
        
// ok we are!
        // now we can post our topic

        // first create our http request
        
HttpWebRequest req forum.CreateTopic(topic);

        
// and now make the request
        
HttpResult result Http.Request(req);

        
// if you want you can check if there were errors
        
if (result.HasError)
        {
            
// oh noes
            // we can log the error if we want:
            
ErrorLog.LogException(result.Error);
        }

        
// you can also grab the response data
        
string responseHtml result.Data;
    }
};

// with both those events setup we can now actually login
// as soon as we do all needed data will get collected and the topic posted
forum.LoginUser(usernamepassword);

// all done! 
There are a lot more handy classes and whatnot in SLE. Even the classes that were used here have a lot more handy properties, functions, etc. You have access to everything that makes SharpLeech tick .
Hyperz Reviewed by Hyperz on . [C#] Posting a topic with SLE - Example Example on how to post a topic using the SharpLeech Engine. You can get the .dll by downloading SharpLeech and add a reference to it in your project. You'll need these namespaces: using System; using System.Net; using Hyperz.SharpLeech.Engine; using Hyperz.SharpLeech.Engine.Net;The example (read the comments): // our login details string username = "name"; string password = "****"; Rating: 5