Move to vs2005 causes errors in external controls

G

Guest

Hi guys

I'm still working through my conversion to VS2005, I'm getting there, but
there's a couple of errors I can't fix.

My project uses a couple of external controls (not written by me), namely
Metabuilders CheckedListBox and the Obout:Calendar control.

Everything worked fine in vs2003, but I keep getting the following error
every time my code tries to call one of the controls...

"Request for the permission of type 'System.Web.AspNetHostingPermission,
System, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed"

I've tried doing enabling Full Trust in .net for all the folders in the web
app, but I'm still getting the errors and can't compile.

Any help would be appreciated!

Cheers


Dan
 
Y

Yuan Ren[MSFT]

Hi Dan,

Welcome to MSDN newsgroup!

Based on my understanding, I think you caught a compiler error when
building the current project in Visual Studio 2005. If I have misunderstood
anything, please let me know.

For the current issue, I would appreciate it if you supplied the following
information:

1. Would you show us the stack for the error? You may use -errorstack when
calling aspnet_compiler in the command line.

2. Is there any trust level set under machine level? Are you intentionally
wanted to run the app under partial trust?

3. Where is the referenced dll? GAC or bin? If none of these how do you set
up binding?

4. Is this particular usercontrol working in the source application before
precompilation?

Thanks for your information! I¡¯m looking forward your reply.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

Hi

Thanks for the reply. You'll have to bear with me, I'm quite new to a lot of
the server stuff so I'm a little lost.... :)

1. I'm using VS2005 "Build Website" option.. can I get that to do a stack
trace? If not, I'll have to work out how to use the clc..

2. Not sure what you mean here, I've used the .NET Configurator to set Full
Trust on the IP for the project (10.0.0.200/*) and also on the file share
(file:///\\server\web\*)

3. Both dll's are in the \bin folder for the project.

4. Sorry, don't understand that one!

Just one other thing, presumably, being dlls already, they don't get
compiled, and therefore it shouldn't be something to do with changes in
aspnet 2 (ie, i shouldn't need to get new versions of the controls?!)

Thanks for trying to help, and I'm sorry I don't understand some of your
questions. If you could provide a bit more info perhaps we can work this out?

Cheers



Dan
 
Y

Yuan Ren[MSFT]

Hi Dan,

Thanks for your reply!

I'm sorry for unclear questions. After my researching, the current problem
seems a known issue. I suggest you try to perform some steps as below:
1 <IPermission class="System.Web.AspNetHostingPermission, System, Version=
2.0.0.0,
Culture=neutral, PublicKeyToken= b77a5c561934e089" Level="Unrestricted" />

Save the string in an XML file. Then open Microsoft .NET Framework 2.0
Configuration Console and expand till:
Runtime Security Policy >> Machin >> Code Groups >> All_Code.>>
My_Computer_Zone.
2 Right click the "My_Computer_Zone" and select "New".
3 Give a proper name for new code group and click "Next".
4 Choose All Code from the only dropdown list and click next.
5 Select Create a new permission set option and click next.
6 Give a proper name to new permission set. And click next.
7 In the middle of the window, down bottom, click "Import..." button.
8 Locate the xml file in which we have saved the permission set string.
9 Click next and then finish.
10 Repeat the same with "LocalIntranet_Zone" and "Internet_Zone" if this
doesn't resolve the problem, please restart the IIS services.

I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

Hi

Thanks - that's definently a solution I haven't come across yet.

Just one thing though, am I supposed to edit this on the machine with VS on,
or the Win2k3 IIS machine?!

Cheers


Dan
 
G

Guest

Hmm, I'm having trouble with this!

I created an XML file with exactly the line you suggested (<IPermission..),
but I can't get the .NET Configurator to use it. It simply says

"The XML file is invalid or does not contain a permission set."

Also, as original question... should I be editing this on the client or
server?! I'm guessing from your post server?!

Cheers.. your help is much appreciated!


Dan
 
G

Guest

Update...

Okay, I tried again on the server, and managed to get the permission into
the .net configuration utility by actually adding the <PermissionSet />
element to the XML file you asked me to create.

Unfortunately it didn't work - even when I added it to Local Intranet and
Internet zones.

However, I did a Ctrl-F5 build and it failed and asked me if I wanted to run
the last successful build, so I selected yes, and it gave me a stack trace!
Here's the result...

Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Web.AspNetHostingPermission, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:


[SecurityException: Request for the permission of type
'System.Web.AspNetHostingPermission, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.RuntimeTypeHandle._GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark&
stackMark, Boolean loadTypeFromPartialName) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +72
System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58
System.Type.GetType(String typeName, Boolean throwOnError, Boolean
ignoreCase) +64
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean
throwOnError, Boolean ignoreCase) +48
System.Web.Configuration.ConfigUtil.GetType(String typeName, String
propertyName, ConfigurationElement configElement, XmlNode node, Boolean
checkAptcaBit, Boolean ignoreCase) +31


-----------------------------------------------------

It definently looks like the issue you talked about, but I can't work out
how to get it to work. Any more suggestions would be greatly appreciated!

Cheers


Dan



"Yuan Ren[MSFT]" said:
Hi Dan,

Thanks for your reply!

I'm sorry for unclear questions. After my researching, the current problem
seems a known issue. I suggest you try to perform some steps as below:
1 <IPermission class="System.Web.AspNetHostingPermission, System, Version=
2.0.0.0,
Culture=neutral, PublicKeyToken= b77a5c561934e089" Level="Unrestricted" />

Save the string in an XML file. Then open Microsoft .NET Framework 2.0
Configuration Console and expand till:
Runtime Security Policy >> Machin >> Code Groups >> All_Code.>>
My_Computer_Zone.
2 Right click the "My_Computer_Zone" and select "New".
3 Give a proper name for new code group and click "Next".
4 Choose All Code from the only dropdown list and click next.
5 Select Create a new permission set option and click next.
6 Give a proper name to new permission set. And click next.
7 In the middle of the window, down bottom, click "Import..." button.
8 Locate the xml file in which we have saved the permission set string.
9 Click next and then finish.
10 Repeat the same with "LocalIntranet_Zone" and "Internet_Zone" if this
doesn't resolve the problem, please restart the IIS services.

I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Y

Yuan Ren[MSFT]

Hi Dan,

Thanks for your supply more information!

I think maybe I ignore some information actually. Could you please tell me
about the relationship between your web application and the custom control?
What I mean is whether the .dll file of the customer control is in the same
machine with the web application. If not, please give me more details.

Additionally, can you add the custom control in the web page in design time?

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

Hi

Thanks for the reply.... hopefully I can answer your questions.

Ok, the website code is all located on my Win2k3 server, in a directory on
the W: drive. W:\Intranet to be precise. All the dlls and everything are
located in the \bin folder below that (W:\Intranet\Bin).

IIS 6 has a website with it's home directory set to W:\Intranet.

The machine running Visual Studio is connected via the normal router setup,
with W:\ on the server being mapped as W:\ on the client machine (to keep
things simple!), and when I open my solution, I'm opening it directly from
the mapped W: (W:\Intranet\Intranet.sln).

It would appear that the dll is being recognised, as if I comment out the
Register line..

<%@ Register TagPrefix="obout" Namespace="OboutInc.Calendar"
Assembly="obout_Calendar_Pro_Net" %>

then the following line...

<obout:Calendar runat="server" ID="calDate" />

gives me the error "Unrecognized tag prefix or device filter 'obout'."

Whereas, if I leave that line in, I get the error.. "Element 'Calendar' is
not a known element. This can occur if there is a compilation error in the
Web site."

Either way, I still get the System.Web.AspNetHostingPermission error.

The control I'm using doesn't have a design time implementation, and if I
try and drag the DLL onto the form, I just get an <a href /> element :)

I hope this helps? The control I'm using has a trial version available at
www.obout.com if that will help.

Hoping you can fix this!!

Cheers



Dan
 
G

Guest

Hi Yuan

I've sorted it!!

Yep, took some doing didn't it, but we got there in the end! I forced myself
to start my logic from scratch, so I moved the code to the same machine as VS
and tried that - worked perfectly.

That meant it was definently a permission issue with VS talking to the
server, so I started hunting round in .net2 config on the vs machine.
Basically I just tried different settings, but it seems that setting a my dI2
group (that I created in All Code) to Application Directory, with Full Trust
seems to have worked.

I'd like to thank you for your help over the last few days, very much
appreciated!

Cheers


Dan
 
Y

Yuan Ren[MSFT]

Hi Dan,

I'm glad to hear you problem has been resolved:)

Maybe next time I'll peform the test with some different environment.
Anyway, it's my pleasure to be of assistance.

If you have any issues in the future, please feel you free to let me know.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top