Thursday, January 19, 2006

How to run your windows application on web ?ie., see you have created a windows application by spending lot of time and resource when you want to create the same application again on web think the time and resource needed for you.To solve out this problem we have a solution.

2 comments:

Prabakar said...

Introduction

This article will help in using the application which you have developed in windows in web. I had developed this project when I think of the time required for developing the same application which I had developed in windows .But this can not be used for huge projects


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)


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



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


4. Now we want to convert the windows application in to an user control 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)


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)

6.Before Compiling the project comment the "thread" (Ref :Figure 6)


Now you have successfully created the user control

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

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" creates and places 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 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)


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



13. Run your web application. Coagulation your windows control is now on web .Your Output form will look like figure (Ref: Figure 10).It will display the internet warning


14. To access the same web form in remote machine we want to create a .inf file and combine the inf file and the dll and create cab file and refer the same cab file in the code base of HTML code.

Conclusion:

Though you have bring the windows application on web it is difficult to run the same on remote machine. Its will be useful for smaller application .

Anonymous said...

Superub........