Question

I am very new to ASP.NET. I just found something interesting when I try to create an ASP.NET application.

I created a button, and wrote the following code in a click event handler:

protected void Button1_Click(object sender, EventArgs e)
{
    Form FormMain = new Form();
    FormMain.Show();
}

I then tried to add a reference to System.Windows.Forms. I ran it, and it worked. When I click on the browser button, a WinForms form appears.

Can I use this technique to build a desktop application such that all the code is in the web?

Was it helpful?

Solution

No, Web applications run in the server.

Desktop Applications run in the client.

This only works because you're running it locally, but it will not work when deploying the ASP.Net Web Application to a Web Server.

If you need to create Web Applications, then use the standard ASP.Net techniques which deliver HTML [+ JavaScript + CSS] content to the browser. You may choose between "traditional" ASP.Net WebForms, or ASP.Net MVC.

If you need to create Windows Desktop Applications, use WPF.

If you need to create Windows 8 "Metro Style" Applications, use WinRT XAML.

winforms is completely useless at this point.

OTHER TIPS

You can do that but this won't give your users any advantages. If you need shared logic than create it as a stand-alone project so it compiles to an independent assembly, after that you can publish it anywhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top