RE: Question Title: Unable to Load a .NET UserControl In Web Browser
From: AmiciDan (AmiciDan_at_discussions.microsoft.com)
Date: 02/18/05
- Next message: Sean Hederman: "Re: Question Title: Unable to Load a .NET UserControl In Web Browser"
- Previous message: Deepak Malkan [Bentley]: "Speed problem in adding TreeNodes to its Parent in a TreeView"
- In reply to: AmiciDan: "Question Title: Unable to Load a .NET UserControl In Web Browser"
- Next in thread: Sean Hederman: "Re: Question Title: Unable to Load a .NET UserControl In Web Browser"
- Reply: Sean Hederman: "Re: Question Title: Unable to Load a .NET UserControl In Web Browser"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Feb 2005 15:25:01 -0800
Where is my MSDN Universal Guaranteed 2-day Reply?
"AmiciDan" wrote:
> I can't get a simple usercontrol to load up in a web page. Below is the
> description of what I'm doing i full details. I know this *should* work
> because I have built other usercontrols on the same system that *do* load up
> just fine. The primary difference is these other usercontrols use additional
> assemblies from an SDK. However, a *basic* usercontrol just won't load.
> What am I doing wrong? It must be something simple I'm missing:
>
> I've written a very simple *test* usercontrol in VC .NET 2003 as a "windows
> control library".
>
> Here're the basic steps broken out:
>
> 1. Create a new C# Project as a "windows control library".
> 1 a. All I did was create the basic project, resize the form to make it
> bigger, and add a Button control on it. I didn't even program the Button. I
> just placed it on the form.
> 2. Compile it and get "testcontrol.dll" (I named the project testcontrol so
> I get testcontrol.dll out).
> 3. Copy "testcontrol.dll" over to a web server virtual directory.
> 4. Create an HTML file and have the following line in the<body> element:
> <object id="testcontrol"
> classid="http://localhost/testcontrol.dlll#testcontrol.TestControl">
> </object>
> where testcontrol is the namespace and TestControl is the name of the class
> as in the .cs file:
>
> namespace testcontrol
> {
> /// <summary>
> /// Summary description for UserControl1.
> /// </summary>
> public class TestControl : System.Windows.Forms.UserControl
>
> 5. Run the MMC snap-in for .NET Configuration Management:
>
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorcfg.msc (your location may
> be slightly different per the version of the Framework installed).
>
> 5 a. Since my Apache server is running locally and I access the web site at
> http://localhost/testcontrol.html, I'll do the following:
>
> In the MMC snap-in, click on
> My Computer
> |
> Runtime Security Policy
> |
> Machine
> |
> Code Groups
> |
> All Code
> |
> LocalIntranet_Zone
>
> 5 b. Right-Click on LocalIntranet_Zone and choose, New.
> In "Create a new code group" under Name: type in the machine_name.
> Click Next
> In the "Choose the condition type for this code group:" select URL
> In the URL text box type: "http://localhost/*"
> Click Next
> In the "Use existing permission set:" select FullTrust
> Click Next, and Finished.
>
> Without doing step 5. you won't have trusted access to the assembly you built.
>
> 6. Now, ideally all should work at this point. Simply open the web page
> http://localhost/testcontrol.html. Here is my HTML file:
>
> <html>
> <head><title>Dan's Most Excellent TestControl Demo</title></head>
> <body>
> <center><h1>Dan's Most Excellent TestControl Demo</h1></center></br>
> <hr></hr>
> <object id="testcontrol" align="middle" border="1"
> classid="http://localhost/testcontrol.dlll#testcontrol.TestControl">
> </object>
> </body></html>
>
> and I've copied testcontrol.dll over to the web server's /htdocs location
> which is also where testcontrol.html is.
>
> However, the control does NOT LOAD. I can't seem to figure out what I'm
> doing wrong. Now, I did to the following:
>
> 7. Create a Strong Name by running:
> "C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\sn.exe" -k
> testcontrol.snk
>
> 7 a. Copy testcontrol.snk to a directory in my build environment (where the
> .CS file is) and add the location ("..\\..\\testcontro.snk") in assembly.cs
> in the
> AssemblyKeyFile() location.
>
> 7 b. Build a new testcontrol.dll with the strong name and copy it to the
> web server directory.
>
> regasm and gacutil it:
>
> C:\Program Files\Apache
> Group\Apache\htdocs>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\regasm /tlb
> "C:\Program Files\A
> pache Group\Apache\htdocs\testcontrol.dll"
> Microsoft (R) .NET Framework Assembly Registration Utility 1.1.4322.573
> Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
>
> Types registered successfully
> Assembly exported to 'C:\Program Files\Apache
> Group\Apache\htdocs\testcontrol.tlb', and the type library was registered
> successfully
>
> C:\Program Files\Apache
> Group\Apache\htdocs>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil /i
> "C:\Program Files\Ap
> ache Group\Apache\htdocs\testcontrol.dll"
>
> Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4318.0
> Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
>
> Assembly successfully added to the cache
>
> 8. Run IE as such: http://localhost/testcontrol.html. The control does
> NOT load. I can even run this in WinDBG the windows debugger and see that
> the control does NOT load into memory. I don't get any error messages. I
> know I must be doing something simple that's incorrect. I need help please!
>
> 9. I did all the same similar steps above with a usercontrol I created
> using the AtalaSoft .NET DotImage and DotAnnotate SDKs in a much more complex
> C# program and it *works*. When I run my UserControl created with the
> AtalaSoft SDK via the HTML file I created under a debugger I can see:
>
> ModLoad: 79170000 79196000 C:\WINDOWS\system32\mscoree.dll
> ModLoad: 79410000 79425000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorie.dll
> ModLoad: 7c340000 7c396000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\MSVCR71.dll
> ModLoad: 79480000 79499000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorld.dll
> ModLoad: 794f0000 79504000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorsec.dll
> ModLoad: 74e30000 74e9c000 C:\WINDOWS\system32\RichEd20.dll
> ModLoad: 732d0000 732d5000 C:\WINDOWS\system32\SOFTPUB.DLL
> ModLoad: 0ffd0000 0fff8000 C:\WINDOWS\system32\rsaenh.dll
> ModLoad: 03a30000 03c96000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll
> ModLoad: 79040000 79085000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
> ModLoad: 79780000 7998c000
> c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll
> ModLoad: 79990000 79ccc000
> c:\windows\assembly\nativeimages1_v1.1.4322\mscorlib\1.0.5000.0__b77a5c561934e089_7e62dfdc\mscorlib.dll
> ModLoad: 79090000 7909c000
> c:\windows\assembly\gac\iehost\1.0.5000.0__b03f5f7f11d50a3a\iehost.dll
> ModLoad: 790b0000 790b8000
> c:\windows\assembly\gac\iiehost\1.0.5000.0__b03f5f7f11d50a3a\iiehost.dll
> ModLoad: 79430000 7947d000
> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\MSCORJIT.DLL
> ModLoad: 7b490000 7b506000
> c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll
> ModLoad: 7b510000 7b5de000
> c:\windows\assembly\nativeimages1_v1.1.4322\system.drawing\1.0.5000.0__b03f5f7f11d50a3a_56ef66e7\system.drawing.dll
> ModLoad: 7b0a0000 7b1ce000
> c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll
> ModLoad: 7b1d0000 7b3b0000
> c:\windows\assembly\nativeimages1_v1.1.4322\system\1.0.5000.0__b77a5c561934e089_9177a4ba\system.dll
> ModLoad: 71b20000 71b32000 C:\WINDOWS\system32\MPR.dll
> ModLoad: 11000000 1100e000 c:\documents and
> settings\dwerken.productivitynet\local settings\application
> data\assembly\dl2\q9hy0rwj.pax\7tek58oz.hhc\b8ff1e30\005dd2dc_4514c501\wwwtiffdemo.dl
>
> where wwwtiffdemo.dll is my .NET Assembly. I don't get this with my much,
> much simpler test control.
>
> The reason I'm doing this is I'm trying to actually use the WebBrowser
> control and SHDocVW to host Office documents in a .NET Assembly UserControl
> in a web page, but there is another issue with Strong Names that I'll ask
> later. I want to simply solve my very simple issue here first.
>
> Thanks,
>
> ---Dan---
- Next message: Sean Hederman: "Re: Question Title: Unable to Load a .NET UserControl In Web Browser"
- Previous message: Deepak Malkan [Bentley]: "Speed problem in adding TreeNodes to its Parent in a TreeView"
- In reply to: AmiciDan: "Question Title: Unable to Load a .NET UserControl In Web Browser"
- Next in thread: Sean Hederman: "Re: Question Title: Unable to Load a .NET UserControl In Web Browser"
- Reply: Sean Hederman: "Re: Question Title: Unable to Load a .NET UserControl In Web Browser"
- Messages sorted by: [ date ] [ thread ]