Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / C#
Article

Using Windows Application on web

Rate me:
Please Sign up or sign in to vote.
1.48/5 (16 votes)
29 May 20063 min read 138K   8   27   29
This article gives you brief idea of how to run your windows application web

Introduction

<o:p> 

This article will helps you to run Windows Application on Web

<o:p> 

Note:<o:p>

                Try to use the Microsoft windows control, Avoid third party control.<o:p>

                Because we are going to use the same control on web<o:p>

<o:p> 

Advantages:

<o:p> 

Reduces the coding time and resource needed for web<o:p>

Bring the desktop to your web<o:p>

<o:p> 

<o:p> 

Requirement:

<o:p> 

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

are third party control that’s not a matter.<o:p>

<o:p> 

Process:

<o:p> 

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

<o:p>

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

Sample screenshot 

<o:p> 

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

Sample screenshot          

<o:p>

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

<o:p>

I> Convert the <o:p>

                    public class Form1 : System.Windows.Forms.Form<o:p>

                                                   TO<o:p>

                   public class Form1 : System.Windows.Forms.UserControl<o:p>

  (Ref: Figure 4)

Sample screenshot

II> Comment the  <o:p>

                        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<o:p>

Of the windows

<o:p> 

Now your windows form application is converted to user control <o:p>

<o:p> 

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

Application to Class Library (Ref: Figure 5)

<o:p>

<o:p>

Sample screenshot

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

 

 

Sample screenshot

Now You have successfully created the user control <o:p>

<o:p> 

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

<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth"><v:f eqn="prod @3 21600 pixelHeight"><v:f eqn="sum @0 0 1"><v:f eqn="prod @6 1 2"><v:f eqn="prod @7 21600 pixelWidth"><v:f eqn="sum @8 21600 0"><v:f eqn="prod @7 21600 pixelHeight"><v:f eqn="sum @10 21600 0"><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><o:lock aspectratio="t" v:ext="edit">

<v:shapetype stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><o:lock aspectratio="t" v:ext="edit">Sample screenshot 

<v:shapetype stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><o:lock aspectratio="t" v:ext="edit">

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

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

string name is <o:p>

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

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

<o:p> 

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<o:p>

<o:p> 

Now the first way of using the user control in the web <o:p>

<o:p> 

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\ ".<o:p>

<o:p> 

11. Then by using the Gacutil.exe register your WindowsToWeb .dll the the registry<o:p>

 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)

<o:p> 

<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth"><v:f eqn="prod @3 21600 pixelHeight"><v:f eqn="sum @0 0 1"><v:f eqn="prod @6 1 2"><v:f eqn="prod @7 21600 pixelWidth"><v:f eqn="sum @8 21600 0"><v:f eqn="prod @7 21600 pixelHeight"><v:f eqn="sum @10 21600 0"><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><o:lock aspectratio="t" v:ext="edit">

Sample screenshot

 

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

 

Sample screenshot

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

<o:p>

<o:p>Sample screenshot 

<o:p> 

<o:p>

Conclusion:

<o:p> 

            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  

<o:p> 

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


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

Comments and Discussions

 
Questionstuck in step 12 Pin
Member 1413434929-Jan-19 22:04
Member 1413434929-Jan-19 22:04 
QuestionConversion Of windows Application to a Web Application Pin
Member 1308701027-Mar-17 2:34
Member 1308701027-Mar-17 2:34 
QuestionDoubt in Step 10 Pin
Sibeesh Passion21-Jan-16 0:37
professionalSibeesh Passion21-Jan-16 0:37 
QuestionUnable to create Pin
wrappingduke9-Jan-14 12:00
wrappingduke9-Jan-14 12:00 
QuestionStuck at 8 step Pin
DSrini11-Jun-13 0:10
DSrini11-Jun-13 0:10 
QuestionAfter step 13 Pin
shyam.vegeta14-Mar-13 5:54
shyam.vegeta14-Mar-13 5:54 
QuestionProblem at step 8 Pin
Hiren H. Patel13-Feb-12 1:40
Hiren H. Patel13-Feb-12 1:40 
QuestionHi Pin
Member 772166127-Jun-11 5:07
Member 772166127-Jun-11 5:07 
QuestionHI Pin
Member 772166127-Jun-11 4:22
Member 772166127-Jun-11 4:22 
QuestionWhy i cannot find CSLID in registry ? Pin
wcwong221-May-10 18:56
wcwong221-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 all Pin
Prabakar Samiyappan3-Nov-08 22:57
professionalPrabakar Samiyappan3-Nov-08 22:57 
Questionneed help for do this procedure.doubt on 10th and 11th steps. Pin
Alexisraj29-Sep-08 23:43
Alexisraj29-Sep-08 23:43 
GeneralFirefox the windows form is not displaying Pin
Lakshmi Sunitha10-Apr-08 1:58
Lakshmi Sunitha10-Apr-08 1:58 
GeneralUsing Windows Application on web Pin
Ezhil_yoga26-Nov-07 20:22
Ezhil_yoga26-Nov-07 20:22 
GeneralRe: Using Windows Application on web Pin
Alexisraj30-Sep-08 0:22
Alexisraj30-Sep-08 0:22 
GeneralCLSID set up Pin
MyDays12-Mar-07 13:07
MyDays12-Mar-07 13:07 
General.exe files for web application Pin
MyDays12-Mar-07 11:14
MyDays12-Mar-07 11:14 
QuestionStuck at Step 11 Pin
Mihir_999_78617-Oct-06 12:28
Mihir_999_78617-Oct-06 12:28 
GeneralStrong name Pin
AndyHug8-Jun-06 20:45
AndyHug8-Jun-06 20:45 
GeneralStopped at step no 10 Pin
AndyHug7-Jun-06 22:46
AndyHug7-Jun-06 22:46 
GeneralRe: Stopped at step no 10 Pin
AndyHug7-Jun-06 23:40
AndyHug7-Jun-06 23:40 
GeneralRe: Stopped at step no 10 Pin
Prabakar Samiyappan8-Jun-06 7:14
professionalPrabakar Samiyappan8-Jun-06 7:14 
QuestionRe: Stopped at step no 10 Pin
Blogdar26-Jul-06 2:57
professionalBlogdar26-Jul-06 2:57 
AnswerRe: Stopped at step no 10 Pin
E. H.1-Aug-06 6:04
E. H.1-Aug-06 6:04 
GeneralRe: Stopped at step no 10 Pin
Prabakar Samiyappan28-Sep-06 1:10
professionalPrabakar Samiyappan28-Sep-06 1:10 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.