Unknown Coder
Unknown Coder

Reputation: 1740

How to call web application inside Windows Application's Browser Control?

I have a web application ready with me. say MyWebApp, I just need to create another windows application that contains a Form with Web-browser Control.

I need to call this web application in to that Web-browser Control. How to do this?

Upvotes: 1

Views: 3041

Answers (2)

Victor Capeluto
Victor Capeluto

Reputation: 106

Could you tell me in what language you want to create the Widows App?

If you want in C#:

private void Navigate(String address)
{
    if (String.IsNullOrEmpty(address)) return;
    if (address.Equals("about:blank")) return;
    if (!address.StartsWith("http://") &&
        !address.StartsWith("https://"))
    {
        address = "http://" + address;
    }
    try
    {
        webBrowser1.Navigate(new Uri(address));
    }
    catch (System.UriFormatException)
    {
        return;
    }
}

To implement this: 1- Create a web control and put it in the windows form (In this case called webBrowser1). 2- Call the navigate method with the address of the website you want to go.

Upvotes: 0

Achilles
Achilles

Reputation: 11299

Just set the URL of the browser control to the URL that hosts your web application.

http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.url.aspx

Upvotes: 2

Related Questions