Call a web application from a windows application

I have 2 seperate projects: A web application in ASP.NET and a windows application in C#.
I want to be able to open the web app from the windows app. What is the most elegant way to do it?

9/5/2005 9:20:18 AM 91979 articles. 4 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 47

Look into the System.Net.WebRequest and System.Net.WebResponse classes. I believe that there are even samples in VS Help on doing what you want.

9/5/2005 10:21:08 AM

i do it once a long a go time

you can use this code as an example

"C:\\Program Files\\Internet Explorer\\IExplore.exe",

also you read a bout process class from the msdn or microsoft onlin msdn

there is also a class you can use it in the com component i am right noe looking it for u

regardes to every one
9/5/2005 11:12:02 AM

reading the question I believe you want the windows application to open a toally separate window (which is a web page) whereby the application then finishes....

if that is right then I am not sure the System.Net.WebRequest and System.Net.WebResponse classes are the right ones...these stream the data for the web page to your application

Have a look at process.start which is in the MSDN documentation...  but to save you time here is the code.


        /// <summary>
        /// Opens urls and .html documents using Internet Explorer.
        /// </summary>
        public void OpenWithArguments()
            // url's are not considered documents. They can only be opened
            // by passing them as arguments.
            Process.Start("IExplore.exe", "");
            // Start a Web page using a browser associated with .html and .asp files.
            Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
            Process.Start("IExplore.exe", "C:\\myPath\\myFile.asp");

9/5/2005 11:18:26 AM
finally i have find u a very good example
that will help u

if you install the .net
go to u r installation device in the computer to lets say it is in c:\
c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Technologies\Interop\Basic\InternetExplorer

this is a very good exmple if you do not have it u can take this  code that i paste it to u

// Copyright

// Microsoft Corporation

// All rights reserved

namespace MInternetExplorer


using System;

using System.Runtime.InteropServices;

using SHDocVw;

public class Explorer


public static void Main()


Explorer explorer = new Explorer();



public void Run()


Object o = null;

String s;



// start the browser

m_IExplorer = new SHDocVw.InternetExplorer();


catch(Exception e)


Console.WriteLine("Exception when creating IE object {0}", e);



// Set the events




// go to home page

m_WebBrowser = (IWebBrowserApp) m_IExplorer;

m_WebBrowser.Visible = true;



// start navigating to different urls

Console.Write("Enter URL (or enter to quit): ");

s = Console.ReadLine();

while (s != "" && m_IExplorer != null && m_WebBrowser != null)


m_WebBrowser.Navigate(s, ref o, ref o, ref o, ref o);

Console.Write("Enter URL (or enter to quit): ");

s = Console.ReadLine();




catch(Exception sE)


if (m_IExplorer == null && m_WebBrowser == null)


Console.WriteLine("IE has gone away");




Console.WriteLine("Exception happens {0}", sE);




void SetAllEvents()


if (m_IExplorer != null)


//1.Navigate Complete event

DWebBrowserEvents2_NavigateComplete2EventHandler ncd

= new DWebBrowserEvents2_NavigateComplete2EventHandler(OnNavigateComplete);

m_IExplorer.NavigateComplete2 += ncd;

//2.Quit Event

DWebBrowserEvents2_OnQuitEventHandler DQuitE

= new DWebBrowserEvents2_OnQuitEventHandler(OnQuit);

m_IExplorer.OnQuit += DQuitE;

//3.Statusbar text changed event

DWebBrowserEvents2_StatusTextChangeEventHandler DStatusE

= new DWebBrowserEvents2_StatusTextChangeEventHandler(OnStatusTextChange);

m_IExplorer.StatusTextChange += DStatusE;

//4.Fired when download progress is updated.

DWebBrowserEvents2_ProgressChangeEventHandler DProgressE

= new DWebBrowserEvents2_ProgressChangeEventHandler(OnProgressChange);

m_IExplorer.ProgressChange += DProgressE;

//5.Command State change event

DWebBrowserEvents2_CommandStateChangeEventHandler DCommandE

= new DWebBrowserEvents2_CommandStateChangeEventHandler(OnCommandStateChange);

m_IExplorer.CommandStateChange += DCommandE;

//6.DownLoad begin event

DWebBrowserEvents2_DownloadBeginEventHandler DDownLoadStartE

= new DWebBrowserEvents2_DownloadBeginEventHandler(OnDownloadBegin);

m_IExplorer.DownloadBegin += DDownLoadStartE;

//7.DownLoad complete event

DWebBrowserEvents2_DownloadCompleteEventHandler DDownLoadEndE

= new DWebBrowserEvents2_DownloadCompleteEventHandler(OnDownloadComplete);

m_IExplorer.DownloadComplete += DDownLoadEndE;

//8.Title Change event

DWebBrowserEvents2_TitleChangeEventHandler DTitleChangeE

= new DWebBrowserEvents2_TitleChangeEventHandler(OnTitleChange);

m_IExplorer.TitleChange += DTitleChangeE;

//9.Property change event

DWebBrowserEvents2_PropertyChangeEventHandler DPropertyChangeE

= new DWebBrowserEvents2_PropertyChangeEventHandler(OnPropertyChange);

m_IExplorer.PropertyChange += DPropertyChangeE;

//10.Before navigate event

DWebBrowserEvents2_BeforeNavigate2EventHandler DBeforeNavigateE

= new DWebBrowserEvents2_BeforeNavigate2EventHandler(OnBeforeNavigate2);

m_IExplorer.BeforeNavigate2 += DBeforeNavigateE;

//11.Document complete event

DWebBrowserEvents2_DocumentCompleteEventHandler DDocumentCompleteE

= new DWebBrowserEvents2_DocumentCompleteEventHandler(OnDocumentComplete);

m_IExplorer.DocumentComplete += DDocumentCompleteE;

//12.Creating a new window event

DWebBrowserEvents2_NewWindow2EventHandler DNewWindowE

= new DWebBrowserEvents2_NewWindow2EventHandler(OnNewWindow2);

m_IExplorer.NewWindow2 += DNewWindowE;

//13.Full Screen event

DWebBrowserEvents2_OnFullScreenEventHandler DFullScreenE

= new DWebBrowserEvents2_OnFullScreenEventHandler(OnFullScreen);

m_IExplorer.OnFullScreen += DFullScreenE;

//14.Menubar change event

DWebBrowserEvents2_OnMenuBarEventHandler DMenuBarE

= new DWebBrowserEvents2_OnMenuBarEventHandler(OnMenuBar);

m_IExplorer.OnMenuBar += DMenuBarE;

//15.Toolbar change event

DWebBrowserEvents2_OnToolBarEventHandler DToolBarE

= new DWebBrowserEvents2_OnToolBarEventHandler(OnToolBar);

m_IExplorer.OnToolBar += DToolBarE;

//16.Visibility change event

DWebBrowserEvents2_OnVisibleEventHandler DOnVisibleE

= new DWebBrowserEvents2_OnVisibleEventHandler(OnVisible);

m_IExplorer.OnVisible += DOnVisibleE;

//17.Threat Mode event

DWebBrowserEvents2_OnTheaterModeEventHandler DTheaterE

= new DWebBrowserEvents2_OnTheaterModeEventHandler(OnTheaterMode);

m_IExplorer.OnTheaterMode += DTheaterE;




//event handlers are below

//1.NavigateComplete Event

static void OnNavigateComplete(Object o1, ref Object o2)


Console.WriteLine("Navigate complete");


//2.Quit event

static void OnQuit()


Console.WriteLine("Internet explorer is quiting");

m_IExplorer = null;

m_WebBrowser = null;


//3.Statusbar text changed

static void OnStatusTextChange(String sIn)


Console.WriteLine("Status text changed with {0}", sIn);


//4.Fired when download progress is updated.

static void OnProgressChange(int Progress, int ProgressMax)


Console.WriteLine("Progress change : progress = {0}, progressMax = {1}", Progress, ProgressMax);


//5.The enabled state of a command changed.

static void OnCommandStateChange(int Command, bool Enable)


Console.WriteLine("Command State change : Command = {0}, Enable = {1}", Command, Enable);


//6.Download of a page started

static void OnDownloadBegin()


Console.WriteLine("Download begins now");


//7.Download of page complete

static void OnDownloadComplete()


Console.WriteLine("Download completes");


//8.Document title changed

static void OnTitleChange(String Text)


Console.WriteLine("Title changes to {0}", Text);


//9.Fired when the PutProperty method has been called.

static void OnPropertyChange(String szProperty)


Console.WriteLine("Property {0} changed", szProperty);


//10.Fired before navigate occurs in the given WebBrowser (window or

// frameset element). The processing of this navigation may be modified

static void OnBeforeNavigate2(Object ob1, ref Object URL, ref Object Flags, ref Object TargetFrameName,

ref Object PostData, ref Object Headers, ref bool Cancel)


Console.WriteLine("Before Navigate2");

m_nCounter += 1;

if (m_nCounter >= 10)


Console.WriteLine("Counter is {0}. Refuse to navigate to the site", m_nCounter);

Cancel = true;

m_nCounter = 0;




Console.WriteLine("Counter is {0}. Permit to navigate to the site", m_nCounter);

Cancel = false;



//11.Fired when document complete

static void OnDocumentComplete(Object o, ref Object ro)


Console.WriteLine("Document complete");


//12.Fired when creating new window

static void OnNewWindow2(ref Object o, ref bool rb)


Console.WriteLine("New window");


//13.Fired when Fullscreen

static void OnFullScreen(bool b)


if (b)

Console.WriteLine("Full Screen");


Console.WriteLine("Not full screen");


//14.Fired when menubar change

static void OnMenuBar(bool b)


if (b)

Console.WriteLine("Menu bar visible");


Console.WriteLine("MenuBar invisible");


//15.Fired when Toolbar change

static void OnToolBar(bool b)


if (b)

Console.WriteLine("Toolbar visible");


Console.WriteLine("ToolBar invisible");


//16.Fired when Visible

static void OnVisible(bool b)


if (b)





//17.Theater Mode

static void OnTheaterMode(bool b)


if (b)

Console.WriteLine("Theater Mode");


Console.WriteLine("Not Threater mode");



//These are class data members

static private SHDocVw.InternetExplorer m_IExplorer = null;

static private IWebBrowserApp m_WebBrowser = null;

static private int m_nCounter = 0;




regardes to every one
9/5/2005 11:28:32 AM

Similar Artilces:

Can a .NET web based intranet application call a windows based .NET application?
   Is it possibly to have an 2.0 application call/invoke a windows desktop application written in .NET 2.0? We have a .NET 1.0 windows desktop application that was written in C#. We also have a new .NET intranet web application written in 2.0. Is it possibly to have a button on the web application that when pressed will invoke the .NET 1.0 windows application? And then if someone closes the application, it will return control back to the ASP.NET 2.0 application?    Are you referring to running a WinForms application on the server or on the client PC? ...

How i call windows application in web application without using dll of windows application
i want to call Windows application in web Application Without using dll of Windows application in 2.0  hi!try this: ProcessStartInfo pi = new ProcessStartInfo("app.exe"); pi.CreateNoWindow = true;  Process p = Process.Start(pi); p.WaitForExit(); if (p.ExitCode != 0){//report error } orzeh  code less, think more!...

How to Call a Window Application from Web Application
 How to call a windows application from a web application. For Example,In, when we click on the green button (Online), GTalk application got invoked. Can anyone please let me know how to do that? Also, i need to know the technical name of this scenario.Please refer some good articles!  Thanks in Advance!!!Srinivasan I don't remember the name of the technology doing this, but basically what you have to do, is the desktop application, during its install (with a Windows Installer or something), has to associate a protocol with itself... for example, you have stuff lik...

Stop and Start a Web Application using Application Pool contains may Web Applications
Hi, In my IIS 6.0, there is a Application Pool. This Application Pool contains 5 Web Application. But I need to stop and restart one particular Web Application. How to do that? What is the process to start and stop a Web Application. when the Web Application uses a Application Pool and the Particular Application Pool contains other Web Application as well.?     if you want like that then create separate application pool for each web application. Then you can start and stop one particular web application. Other easy way is just modify the web.config file of you...

How to call a windows based application through a web based application
 Hi All, I am using a web based application in which i need a particular windows based application at a given time when the user wants it. But i am not able to link them. Plz give any solution Ok this will be a good game for you. Go to the local computer whose windows application is to be accessed. Go to Control Panel, Administrative Tools, Component Services, browse to Component Services->My COmputer ->DCOM Config -> Here select your application..right click security tab...access access permission ...

How to extract xml file from window application to web application in .net
hi..i have two software solutions both in .net one is desktop and another is web application.And i want to transfer data between these application using xml. In desktop solution i have created a xml schema and create a xml document that conforms to that schema.XML doucment is created which contains the data.Now i have to extract this xml document into my web application and store the data of this xml file into my database and vice versa. So tell me what are the different methods to get the document from desktop to web and from web to desktop.Actaully i am not much aware of this type i...

call a window application method from php web application or javascript
Can any one tell me hw this will be possible call a window application method from php web application or javascript  ?? I am having a scenario in which i have to create a window application in that will installed on the client machine.then I have to a access particular site which is in PHP now from PHP or javascript i have to call the method of  Can anyone tell me the solution...... ======================================Regard,Pradeep SahooTeam LeaderDon't forget to click "Mark as Answer" on the post that helped you. OK, just so I ...

Web Application our Windows Application
Hello I am Mona ali, I am developing  a project for HR Management.There is a bank with a lot of people information and about 40 users will work with this bank.  I dont know if  it would be better to design this project in web our windows apllication. Please guide me ASAP! Thanks Mona A windows application would be more secure if the data will be sensitiveMark this post as 'Answer' if (answer == true)Construction Software : www.proccm.comHomeowners place to find contractors Hi could you be more specific as to your requirements....

Call one web application forms with in another web application ..
I am having forms named A1,A2,A3,A4,A5 in my web application1. And i am having B1,B2,B3,B4 and B5 in my web application2.I am using Windows authentication for my web application1. And i am using Form Authentication for my web application2.I am planning to host these 2 applications in 2 different servers.Here i am planning to have web application1 as a stand alone application.And Web application2 should interact with web application1.I want to call my web application1 forms in my web application2.But both authentication types are different.........???How to do it....??Any ideas ??Kamran Shahi...

Migrating from Visual Studio .NET 2003 Windows Application to Visual Studio 2005 Web Application
How do I migrate a Visual Studio .NET Windows Application to Visual Studio 2005 Web Application. Are there any tools available for this.  As far as I know there is no direct migration path. You convert VS2003 to VS2005 and then to VS2005 Web Application.Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. manish kumar: How do I migrate a Visual Studio .NET Windows Application to Visual Studio 2005 Web Application. Are there any tool...

Using .net AJAX enabled application in non .net Web Application
Hi,Does anyone have similar experience in development?  I want to check if it's possible to run .net ajax object (from one standalone .net framework platform in company) with non .net application (i.e. J2EE web application)?  It is because we want to add certain feature (i.e. office communicator chat) to our exist application (oracle J2ee). Please give me some advice :) Thanks! Hi, .Net AJAX is based on .Net Framework architecture. Thus .Net Framework currently lacks support for other platforms, such as Java. Please check this link:

Calling PB application from other web application
Friends, I have a situation here. I have a powerbuilder 7.0 application with windows, datawindows and database access. NOw, the management needs this powerbuilder application to be called by another web application. I would appreciate if you could give me the possible solutions. Thanks, Saravanan What does the application need to return? If you just want to launch the original PB application from a web page, you should look at the web deployment kit. If you need to return data to the other web app, you might look at deploying PB objects into Jaguar and then calling t...

opening windows application from web application
hi i'm new to this forum. hi to everyone. i want to open a windows application from my web application i did that by using process start method. but button click event in windows application is not firing.. suggest me.. asap Welcome to the forums I didnt understand your question. First you need to tell us where the windows application is located (on the server or on the client side). If it is on the server, check Execute exe application in ASP.NET. If the application is on the client side, you can't run it due to security issues. However, try to search for an activeX contro...

merge windows application with web application
hi all : I just wanna know how to merge windows application (with a local database server) ,with a web application (with a remote server) ,using XML web services ,and make the data on the remote server up-to-date.please i need a great details... thank for your time Check out my article on DotNetJunkies, I think it will help you accomplish what you're saying....

Web resources about - Call a web application from a windows application -

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

The Bachelor 2016 application process can get explicit - Laurina Fleure
CHANNEL Ten is calling on singles to sign up for a chance to find love on The Bachelor , but willing applicants have to open a lot more than ...

Perth man’s Afghan wife slapped with 10-year visa application ban - PerthNow Search Search
A MAN’S three-year struggle to have his wife live with him in Australia has ended in heartache after his spouse was slapped with a 10-year ban. ...

MBA: Mortgage Applications Decrease in Latest MBA Weekly Survey, Purchase Applications up 24% YoY
From the MBA: Mortgage Applications Decrease in Latest MBA Weekly Surve Mortgage applications decreased 3.2 percent from one week earlier, according ...

Elon Musk Requests Applications For Autopilot Software Engineers On Twitter
... and more quickly achieve “generalized full autonomy.” So, if you ever wanted to work for Tesla in such a [&hellip Elon Musk Requests Applications ...

Mortgage applications fall 3.2%
A definitive rise in mortgage interest rates over the last month is keeping borrowers at bay.

Help wanted: Obama's tech-training project now accepting applications
Organizers of innovative training programs can now apply for a federal grant to help prepare low-wage workers for more-lucrative tech jobs.

Number Of Daily Applications To French Military TRIPLES Overnight
Number Of Daily Applications To French Military TRIPLES Overnight

PCB firm Unitech looks to automotive, IoT applications for 2016 growth
PCB maker Unitech Printed Circuit Board expects demand for any-layer designs for use in automotive electronics, wearables and other IoT-connected ...

Windows 10’s broken fall update removes user-installed applications without asking first
Microsoft's latest Windows 10 update is causing problems for at least some users, and uninstalling programs without the user's consent or evidence ...

Resources last updated: 12/1/2015 2:10:24 AM