Using Windows Control on an ASP.NET web page

There can be a number of occasions when you would want to use a windows control on your webpage. For my one, I wanted to bypass the proxy server at work by using the WebBrowser control. The problem was that it was only available to use on Windows Forms and I needed it to work on my webpage. The idea behind it was that I would be able to browse to my web page which contained the WebBrowser control (as this page would not be banned at work because it will be hosted on a shared hosting server) and all web page requests would be provided by the hosting company rather than directly through the internet connection at work.

I created a Windows Control Library which contained the WebBrowser control and dropped the dll in the root of the website where I would call it from. I made a simple page and within the web form I added the following:

<!– Code Starts Here –>
<OBJECT id=”sert” classid=”http:GisBrowser.dll#GisBrowser.SurfControl” height=”450″ width=”800″ VIEWASTEXT>
<PARAM NAME=”Title” VALUE=”My Title”>
<!– Code Ends Here –>

The reason the dll does not go into the bin folder is because it needs to be accessible by the clients (browsers requesting the page) and anything in the bin folder is available to the server only.

Unfortunately the code did not work but this happens only with the WebBrowser control. If you choose any other control, it should work fine. I tried it with a label, treeview and a groupbox and they worked fine.

For references, please see: 

On a side note, if you ever wanted to grab the thumbnail of a website dynamically using C#, this link will tell you how to do just that : 

comments powered by Disqus