Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Help needed with strong name web part

Reply
Thread Tools

Help needed with strong name web part

 
 
Philip Colmer
Guest
Posts: n/a
 
      07-10-2004
I'm trying to create a very simple web part that makes use of an external
DLL. The DLL tries to communicate with an external web site and I'm getting
a permissions exception when I try to add the web part to a SharePoint page.
From the research I've done, I think that this is because I've installed the
web part into the bin folder where the trust level is low and access to
external sites is not permitted.

I therefore want to rebuild the part with a strong name so that I can
install it into the GAC. Adding a strong name to my own code is
straight-forward enough but the Interop DLL that Visual Studio built for the
external DLL does not have a strong name and I can't figure out how to add
one.

So that is my problem. I'm using a DLL that I did not build. Visual Studio
has built an Interop DLL and I need to ensure that it is built with a strong
name.

Can someone please tell me what steps I need to take?

Thanks.

--Philip


 
Reply With Quote
 
 
 
 
[MSFT]
Guest
Posts: n/a
 
      07-12-2004
Hi Philip,

You can grant proper trust level on this assembly in ".NET configration
wizard". Additionally, you need to check the ASP.NET security also. The
external DLL will use the ASP .NET application's account to communicate
with external web site. This account may not have enough permission to do
this.

Luke

 
Reply With Quote
 
 
 
 
Philip Colmer
Guest
Posts: n/a
 
      07-12-2004

"[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Philip,
>
> You can grant proper trust level on this assembly in ".NET configration
> wizard". Additionally, you need to check the ASP.NET security also. The
> external DLL will use the ASP .NET application's account to communicate
> with external web site. This account may not have enough permission to do
> this.


Are you suggesting, then, that I should leave my web part in /bin and not
try to install it in the GAC?

If that is your recommendation, then I'll go with that and change the trust
level. However, I thought that best practice was to strongly-name web parts,
which is where I was getting stuck. Not on my own web part, mind, but on the
Interop DLL that Visual Studio created.

--Philip


 
Reply With Quote
 
[MSFT]
Guest
Posts: n/a
 
      07-13-2004
Hi Philip,

Assemblies in GAC may not be full trust. I would like suggest to grant
trust for an assembly With .NET Configaration Wizard. You may refer to
following article:

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconadministrationwithcodegroupattributes.asp

Luke

 
Reply With Quote
 
Philip Colmer
Guest
Posts: n/a
 
      07-13-2004

"[MSFT]" <(E-Mail Removed)> wrote in message
news:V%(E-Mail Removed)...
> Hi Philip,
>
> Assemblies in GAC may not be full trust. I would like suggest to grant
> trust for an assembly With .NET Configaration Wizard. You may refer to
> following article:
>
>

http://msdn.microsoft.com/library/de...us/cpguide/htm
> l/cpconadministrationwithcodegroupattributes.asp


Luke

Unless I am misunderstanding something, the .NET Configuration Wizard
controls assemblies in the GAC, yes? It does NOT alter the security
permissions for assemblies in the local /bin folder - correct?

If I have understood that correctly, then I am still stuck with my original
problem - how do I take the Interop DLL that Visual Studio 2003 has built
for me from a COM DLL and strongly name it so that I can install it into the
GAC? The MSDN documentation on installing an assembly into the GAC only
references strong-named assemblies:

http://msdn.microsoft.com/library/de...emblycache.asp

As I stated in my previous posting, it was my understanding that it is best
practice to strongly-name assemblies and it is THIS that I'm stuck on, not
altering the permissions applied to the assembly.

Regards

Philip


 
Reply With Quote
 
[MSFT]
Guest
Posts: n/a
 
      07-14-2004
Hi Philips,

You may open Administrator tools\microsoft .NET framework 1.1 wizard. In
the wizard, you can trust any .NET assembly even it wasn't in GAC.

Luke,

 
Reply With Quote
 
Philip Colmer
Guest
Posts: n/a
 
      07-15-2004

"[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Philips,
>
> You may open Administrator tools\microsoft .NET framework 1.1 wizard. In
> the wizard, you can trust any .NET assembly even it wasn't in GAC.


Using the wizard, I have granted full trust to both my web part DLL and the
Interop DLL. I'm still getting a
System.Security.Permissions.SecurityPermission exception. I have restarted
IIS after changing the trust level.

--Philip


 
Reply With Quote
 
[MSFT]
Guest
Posts: n/a
 
      07-16-2004
Hi Philip,

You may add SuppressUnmanagedCodeSecurity Attribute in your code to see if
it will help. Here is the socument for it:

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemsecuritysuppressunmanagedcodesecurityat tributeclasstopic.asp

Luke

 
Reply With Quote
 
[MSFT]
Guest
Posts: n/a
 
      07-19-2004
Hello Philip,

Does SuppressUnmanagedCodeSecurity Attribute work for the issue?

Luke


 
Reply With Quote
 
Philip Colmer
Guest
Posts: n/a
 
      07-20-2004

"[MSFT]" <(E-Mail Removed)> wrote in message
news:%23ey%(E-Mail Removed)...
> Hello Philip,
>
> Does SuppressUnmanagedCodeSecurity Attribute work for the issue?


Unfortunately I cannot find a way of adding this to my code. I'm writing the
code in VB.Net and all of the examples of using this attribute are in C#.
I've tried lots of permutations but the compiler just rejects it. I guess
I'm getting the syntax wrong somewhere but, as I say, I can't find a VB
example of how to incorporate this.

--Philip


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: "Strong typing vs. strong testing" namekuseijin Python 229 10-29-2010 09:02 AM
Re: "Strong typing vs. strong testing" namekuseijin C Programming 214 10-17-2010 01:12 PM
adding a variable name to a hash to name is part of the variable name Bobby Chamness Perl 2 04-22-2007 09:54 PM
Compilation fails when a windows form user control is assigned a strong name but it refers to an activex control which does not have strong name ashish_gokhale ASP .Net Web Controls 0 05-05-2005 01:38 PM
Strong name a ASPX web Page --- Question Gopal Krish ASP .Net 5 11-05-2004 04:13 PM



Advertisments