I will explain the steps to create
a web application with windows controls. I think it would more interesting if
you can do all the windows things in browser. Don’t think it will support all
the WinForm’s features in IE.
We should create user control’s, we can replace
only the user controls in IE.
It will work only in IE, it doesn’t support any
It should installed the .NET framework in the
Site should be trusted site list in browser.
Bowser should allow downloading the files from
Steps to create one sample:
Create a Solution
Create a Web Application. Please note we should
create the web application in IIS. If you are creating the ASP.NET Web application
then you have to change the path to web server. Go to the project properties
and change the location. If you are using Visual studio development server you
may face a lot issues like fusion binding error, modified changes don’t
Create another windows class library project and
place some windows controls here (MyFirstUserControl).
Just add some code in user controls (eg.)
void btnMyFirstApp_Click(object sender, EventArgs
MessageBox.Show("Hi, This is my first windows calendar application
In Web application create one folder (here I
have given name “WindowsControls”)
We need to place the output of wincontrols
project to the Web application’s WinControls folder, instead of adding the
reference. We can do this manually all the time; also we can use the Visual
studio feature for this. Go to the class library project properties ->Build
change the output path (..\WebApp\WinControls5\).
We need to place the windows user control into the
Web page using Object tag, samples given below. Important thing need to make
sure that the classid (DLL’s physical location#namespace
of user control).
Rebuild the solution and run the web
application. You can see the window calendar control in IE now. J
If you are using any other assembly as a
reference in the user controls that we should place in the same folder (WinControls).
Look this example here I have created DataAccessLayer and user control will
call one method from this which is GetMessage(). Our case it is not required to
copy anything; once we will add the reference it will copy the output files into
this specific folder.
You never see the files in solution explorer by
default, you need go to the Show all files option and include files whatever
you need. But this is optional; we already mapped this folder in IIS.