Click to See Complete Forum and Search --> : Problems using .Net User Controls in web page


MrBobsy
May 16th, 2007, 05:43 AM
Hi, I've developed a web application that uses .Net user controls (C#) downloaded from a Strong Named DLL using <object> tags. I deployed the test system to site, but the user controls do not appear on all IE browsers, even though they are using the same .Net 1.1 security settings.

At this moment in time I have successfully managed to view the live site web pages using:

Winnt 4 with IE6
Windows 2003 Server with IE7
Windows XP SP2 with IE7 (My development box, so lots of settings will have been modified)

But the controls refuse to load on another XP SP2 with IE7 and as far as I am aware I have used the same security settings. I searched for a downloaded copy of the DLL on the offending machine, but could not find it, should it have been downloaded ?

Here are the steps I took for installing the .Net framework and setting up the security:

- Install the "Microsoft .Net 1.1 Framework" ("C:\dotnetfx.exe")
- Then open "Administrative Tools"->"Microsoft .Net Framework 1.1 Wizards"
- Double click "Adjust .Net Security"
- Select "Make changes to this computer"
- Select "Trusted Sites" and set to "Full Trust"
- Then open "Administrative Tools"->"Microsoft .Net Framework 1.1 Wizards"
- Double click "Trust an Assembly"
- Select "Make changes to this computer"
- Enter the URL: http://fred:8180/counts/countsui.controls.dll
- Select "Trust this one assembly"
- Set minimum level of trust to "Full Trust"
- In Internet Explorer "Internet Options"
- Click on the "Security" tab
- Click on "Trusted Sites"
- Click on the "Sites" button
- Add http://fred:8180/counts
- Ensure that the security level for "Trusted Sites" is "Low"

There were also problems with another XP machine on site, but this one also had .Net framework 2.0 on it. The guy on site also had to modify the security settings using the 2.0 SDK (350Mb download ???) before the user controls would appear on the web page.

Any settings I have missed ?

Are there any tools I can use on the web page side in order to discover why the user controls are not appearing ?

Any advice will be appreciated,

Bob.

MrBobsy
May 16th, 2007, 06:36 AM
I think I may have solved the problem (for now at least) using a solution mentioned in http://support.microsoft.com/default.aspx?scid=814669

But it still doesn't answer why the control worked on some machines but not others, any ideas ???

I quote:

"When you host a strong named .NET UserControl class in Microsoft Internet Explorer, the control does not render even if you create a machine-level code group for that strong name and then grant the code group Full trust in the Microsoft .NET Framework Configuration Tool (Mscorcfg.msc)."

"The Microsoft .NET Framework requires that you explicitly enable strong-named assemblies that partially-trusted callers such as Internet Explorer use. You must now declare the strong-named assemblies that are designed for use by partially-trusted code. Without this explicit declaration, the caller must have Full trust permissions to use the code."

"Assemblies that are intended to be called by partially trusted code must declare the custom attribute, System.Security.AllowPartiallyTrustedCallersAttribute class."

Bob.