There can be a number of occasions when you would want to use a windows control on your asp.net 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 asp.net 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 :
By default, ASP.NET does not use impersonation, and your code runs using the ASP.NET application’s process identity. On the Microsoft® Windows Server™ 2003 operating system, ASP.NET applications run in an Internet Information Services (IIS) 6.0 application pool by default. The IIS application pool runs under the NT AUTHORITY\Network Service identity. On the Microsoft Windows® 2000 Server operating system with IIS 5.0 or on Windows Server 2003 with IIS 6.0 configured for IIS 5.0 isolation mode, ASP.NET applications run in a worker process that uses the local ASPNET account identity.
It might not be obvious where the machine.config file is located for .NET 3.5 Framework, so here’s what Scott Gu said:
The configuration files for applications are versioned using the CLR version, and not the framework library versions. .NET 3.5 uses the same CLR version as .NET 2.0 – and so share the same root web.config file. That is why putting the configuration settings there would cause conflicts.
And here’s the locations for the machine.config for the different .NET Frameworks:
For .NET Framework v1.1:
For .NET Framework 2.0:
For .NET 3.0 and 3.5:
I’ve wanted to learn how to ride horses for a while now and today was my first lesson. For £22 an hour, it was all worth it. I had to pay 50 pence to hire a hat as well. I went to King’s Oak horse riding school and although the people training us beginners were quite young, let me rephrase that actually, kids (most of them), they were really good and know what they were doing. I really enjoyed myself and thinking of taking it up as a hobby now