Click here to Skip to main content
Click here to Skip to main content

Using Windows Application on web

By , 29 May 2006
 

Introduction

 

This article will helps you to run Windows Application on Web

 

Note:

                Try to use the Microsoft windows control, Avoid third party control.

                Because we are going to use the same control on web

 

Advantages:

 

Reduces the coding time and resource needed for web

Bring the desktop to your web

 

 

Requirement:

 

Develop a windows application .For developing weather you can use windows controls

are third party control that’s not a matter.

 

Process:

 

1.open  "New Project "  select Visual C# Project  and select windows application  and

name the project as  'WindowsTOWeb' and click open (Ref :Figure 1)

Sample screenshot

           2. Design the form as shown in the (Ref: figure 2)

Sample screenshot 

 

           3. When you run the form the form will look like this in windows (Ref: Figure 3)

Sample screenshot          

4. Now we want to convert the windows application in to a usercontrol to convert the windows

 application in to user control we need to follow the following steps

I> Convert the

                    public class Form1 : System.Windows.Forms.Form

                                                   TO

                   public class Form1 : System.Windows.Forms.UserControl

  (Ref: Figure 4)

Sample screenshot

II> Comment the 

                        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

Of the windows

 

Now your windows form application is converted to user control

 

5. Now click the property of the project and change the “Output Type" from Windows

Application to Class Library (Ref: Figure 5)

Sample screenshot

6. Before compiling the project comments the "thread" (Ref: Figure 6)

 

 

Sample screenshot

Now You have successfully created the user control

 

7. Now add web application in the same solution it self (Ref: Figure 7)

Sample screenshot 

8. Now create a strong name for your user control by using "sn.exe " which is in the location

'C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin'.The syntax for creating the

string name is

"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\sn -k "C:\Strongname.snk"

now the strong name has been created and it is in the c: in the name of strongname.snk

 

9. After creating the strong name specify the path of the strong name in "Assemblyinfo.cs "

file in the [assembly: AssemblyKeyFile("c:\strongname.snk")] attribute

 

Now the first way of using the user control in the web

 

10. Now by using the "regasm.exe" create and place the CLSID of your dll in the registry

the exe file which is in the location "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ ".

 

11. Then by using the Gacutil.exe register your WindowsToWeb .dll the the registry

 Then go to the registry and search by the name "WindowsToWeb.dll" and copy the CLSID to the

code behind as Specified in the figure (Ref: Figure 8)

 

Sample screenshot

 

12. Now you can see the windows control in the web form (Ref: figure 9)

 

Sample screenshot

13. Run your web application. Congrats your windows control is now on web

Sample screenshot 

 

Conclusion:

 

            This is the sample application which I have created when I am in position to run

the windows application which I have created on web page. By using this you

can run only the simple application  

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

as_prabahar
Web Developer
United States United States
Member
I am Prabakar working as Software Engineer .I had been working in Microsoft Platform for the past 3+ years.I have also completed MCP.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionAfter step 13membershyam.vegeta14 Mar '13 - 5:54 
Hi,
After step 13, i need to get values of a listbox in windows form shown in the aspx page in an another page..
how can i get the contents of the listbox for further flow of web application
QuestionProblem at step 8memberHhiren13 Feb '12 - 1:40 
Please anyone can told me how can I generate the string name & how to use it..
I stopped over there..
 
I really need this solution.
 

Thanks in advance.
QuestionHimemberMember 772166127 Jun '11 - 5:07 
Now i get the Page in the IE, But it is not displaying the controls
 
Getting Blank page with picture of cross mark in that, i am using .net 2008 and windows 7 server os, can u pls help to sort out this problem.
QuestionHImemberMember 772166127 Jun '11 - 4:22 
HI,
 
Your article was good, but got stuck in adding the clsid to the html file in the object tag,
as it shows the error.
 
Server Error in '/' Application.
--------------------------------------------------------------------------------
 
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
 
Parser Error Message: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
 
Source Error:
 

Line 10: <body>
Line 11: <form id="form1" method="post" runat="server">
Line 12: <object id="windowstoweb" height="0" width="0" classid="clsid:B6C864C0-16CD-36D5-BB02-9DF6A1B2611A" VIEWASTEXT
Line 13: runat="server">
Line 14: <param name="Visible" value="true"/>

 
Source File: /default.aspx Line: 12
 

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4961; ASP.NET Version:2.0.50727.4955
QuestionWhy i cannot find CSLID in registry ?memberwcwong221 May '10 - 18:56 
After i execute my WindodsTOWeb.dll by using regsam.exe, i cant found my dll in CSLID in registry.
What shoud be the problem? Thanks.
GeneralThanks to allmemberPrabakar Samiyappan3 Nov '08 - 22:57 
Hey Thanks to all for giving the feedback .But the fact is i did this before 3 years for a very small application , its not advice able to do this for bigger application , because lot of security risk are there . and most of the secure n/w will block this .
Questionneed help for do this procedure.doubt on 10th and 11th steps.memberAlexisraj29 Sep '08 - 23:43 
i dont know how to create classs id for my window project,can anyone help me?
let me know the brief notes for this 10th and 11th steps.
 
expecting brilliant result from genius.
GeneralFirefox the windows form is not displayingmemberLakshmi Sunitha10 Apr '08 - 1:58 
Hi
Thanks for posting such a nice article
In IE its working fine but in firefox the form is not displaying
any one know the solution for this?
 

Regards
Sunitha
 
Sunitha

GeneralUsing Windows Application on webmemberEzhil_yoga26 Nov '07 - 20:22 
hi, i have done what ever u have mentioned ,but iam not getting the result in my web page .
My Aspx page contains the following code
<object id="web" width="400" height="500" classid="CLSID:08556EAB-B0DF-482F-A0C5-0B7E5E14BB99">




</object>
 
My windows applications contains only a single button and label .
 

 
Thanks in Advance
Ezhil

GeneralRe: Using Windows Application on webmemberAlexisraj30 Sep '08 - 0:22 
hi friend,
i need ur help, u did almost all the steps.can u tell me how u did those steps. i struggle with 10th and 11th steps.
can u help me if possible.
 
thanks
Alexis

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 29 May 2006
Article Copyright 2006 by as_prabahar
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid