I need to implement a DLL that will take the parameter passed (SessionNumber) and add it to a web address, and then launch the default browser using that address.

I'm having problems getting it to work correctly.

Currently, I have:

namespace WebsiteLaunch
{
    public class LaunchSite
    {
        public LaunchSite(ref string SessionNumber)
        {
            string SessionPassed = SessionNumber;
            string target = "https://www.website.com/sessionHandler.do?" + SessionPassed;

            try
            {
                System.Diagnostics.Process.Start(target);
                SessionNumber = "SUCCESS";
            }
            catch
            {
                SessionNumber = "ERROR";
            }
        }
    }
}

The source compiles fine, but doesn't work successfully when called from another program.

Does the "ref" value for the variable "SessionNumber" that gets returned to your calling program get set to "ERROR", or does the whole thing blow? If so, you may want to trap the exception to see what its giving you.

try
{
    System.Diagnostics.Process.Start(target);
    SessionNumber = "SUCCESS";
}
catch (Exception ex)
{
    Console.WriteLine("Exception {0}", ex.Message);
    SessionNumber = "ERROR";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.