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   
QuestionStuck at Step 11memberMihir_999_78617 Oct '06 - 12:28 
I found this article really useful and I am able to execute till step no. 10 But I am not able to do step no. 11. When I try to run gacutil.exe using this command
 
C:\WindowsTOWeb\WindowsTOWeb\obj\Debug>"C:\Program Files\Microsoft Visual Studio
.NET 2003\SDK\v1.1\Bin\gacutil.exe" /i WindowsTOWeb.dll
 
OR
 
C:\WindowsTOWeb\WindowsTOWeb\bin\Debug>"C:\Program Files\Microsoft Visual Studio
.NET 2003\SDK\v1.1\Bin\gacutil.exe" /i WindowsTOWeb.dll
 
I got the following error in both cases.
----
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
 
Failure adding assembly to the cache: Attempt to install an assembly without a s
trong name
-----
What does thi gacutil.exe do?
how can I see CLSID generated in the registry and is CLSID generated in step 10 or step 11?
 
Thanks in advance and really appreciate your help......
 
Mihir
GeneralStrong namememberAndyHug8 Jun '06 - 20:45 

Man , I inserted that line in the VB code allready ... My problem was at gacutil ... still I managed to create an reg file for my dll and i registered it ... But I dont know from where to get my class ID and where to put it , so that the webservice to recognize my control ...
In your article the final step is some code where is an ClassID ... but I cant find this code ... So please tell what I do wrong and how can I complete this task

GeneralStopped at step no 10memberAndyHug7 Jun '06 - 22:46 

 
I find your article very interesting and I tried to make one simillar in my computer but I
can't find regasm and other program at all.
There are few explications at no 10 and 11 and I would like to ask you if you can datail.
 
Thnak you.
GeneralRe: Stopped at step no 10memberAndyHug7 Jun '06 - 23:40 

I created a strong name for my dll with sn ... names wintoweb.snk
After that I used regasm file like this :
regasm /tlb:wintoweb.tlb wintoweb.dll
it worked ok ... the problem will arise just now ...
when i execute "gacutil /i wintoweb.dll" the following error message appears :
FAILURE ADDING THE ASSEMBLY TO CACHE : ATTEMPT TO INSTALL AN ASEMBLY WITHOUT A STRONG NAME

GeneralRe: Stopped at step no 10memberasprabahar8 Jun '06 - 7:14 
After creating your Strong name you want to give the path of the strong name in assembleyinfo.cs file like this
[assembly: AssemblyKeyFile("C:\Strongname.snk")]
QuestionRe: Stopped at step no 10memberdotguru26 Jul '06 - 2:57 
I have three questions:
First:
There are two Assembly.cs files. Should I put the strongname in the Windows or the Web application?
 
Second:
Please show how you use the regasm?
This is what I put: regasm D:\Dev0805\WinForms\WindowsTOWeb\bin\Debug\windowstoweb.dll
Is it correct?
 
Third:
How do you get CLSID in Step 10?
 
How do you add the <OBJECT> tag in HTML? Is it from the toolbox?
 
Thanks for your help.
Big Grin | :-D
AnswerRe: Stopped at step no 10memberE. H.1 Aug '06 - 6:04 
1: I put the strongname in the Windows
 
2: C:\VSS\CADS\WebCADS\WinToWeb\WindowsToWeb\bin\Debug>C:\WINDOWS\Microsoft.NET\Fra
mework\v2.0.50727\RegAsm.exe /tlb:wintoweb.tlb WindowsToWeb.dll
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.
 
3: I am now stuck at step 11: I attempted to run RegEdit.exe and Find the WindowsToWeb.dll but I receive no result even I can see in the folder C:\Windows\Assembly, I have the WindowsToWeb.dll assembly is successfully registered there.
 
PLEASE HELP. THANKS A LOT.
GeneralRe: Stopped at step no 10memberasprabahar28 Sep '06 - 1:10 
After creating the Dll with strong name the CLSID can be created by using regasm.exe tool which is present in the c:Windows\Microsoft.net\framework\.....
 
when you pass your dll to regasm.exe the tool will create the CLSID the CLSID will be present in the registry of the system .copy the CLSID and paste in the HTML as shown above and proceed the process
GeneralRe: Stopped at step no 10memberasprabahar8 Jun '06 - 7:16 
Feel free to ask any question
GeneralRe: Stopped at step no 10memberSteve Tellijohn15 Jun '06 - 4:49 
Can you give a little more detail on what to do for step 11. I am able to do all the steps up to step 11 without any problems, but i am a little confused with what I am supposed to do for step 11.

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