Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / February 2006

Tip: Looking for answers? Try searching our database.

SecurityException when calling a Web Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
José Nunes - 20 Feb 2006 19:56 GMT
Hi,

I'm developing a Windows Control Library to use as Smart Client in a
ASP.NET application and one of the tasks of my custom control is call a
WebService. So, when i try to call the WebService using my control
through the IE, i get this exception:

System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
  at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet)
  at System.Security.CodeAccessPermission.Demand()
  at System.Net.CredentialCache.get_DefaultCredentials()
  at
System.Web.Services.Protocols.WebClientProtocol.set_UseDefaultCredentials(Boolean
value)
  at
com.Enterprise.Impressao.webCaixa.Caixa.set_UseDefaultCredentials(Boolean
value)
  at  com.Enterprise.Impressao.webCaixa.Caixa..ctor()
  at  com.Enterprise.Impressao.PDV.enviaReducao(String[]
memoriaFiscal, Boolean isReducaoZ)
  at com.Enterprise.Impressao.PDV.fecharCaixa()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.EnvironmentPermission

and i call my webService at enviaReducao() method. I've trusted my
assembly as FullTrust too.

What should i do?

thanks in advance.
Jas - 20 Feb 2006 22:09 GMT
Jose,

Are you sure the smart client is actually granted full permission by the
runtime?  It looks like its not being granted permission to read some
environment variable.  Use the wizard to "evaulate assembly".

jas

> Hi,
>
[quoted text clipped - 32 lines]
>
> thanks in advance.
Nicole Calinoiu - 21 Feb 2006 13:30 GMT
How have you granted unrestricted permissions (full trust) to your assembly?
Also, was this done on the web server or on the client machine where the web
page is being viewed?

> Hi,
>
[quoted text clipped - 32 lines]
>
> thanks in advance.
José Nunes - 23 Feb 2006 15:01 GMT
Well, i solved it just putting the following lines above my webservice
method caller...:

[WebPermission(SecurityAction.Assert, Unrestricted = true)]
[EnvironmentPermission(SecurityAction.Assert, Unrestricted = true)]

And i trusted my assembly in the client machine using a Strong name key
generated by the sn.exe. In the .net framework configuration i created
a new codegroup called "MyComponent", using the membership condiction
type as Strong Name and the Permission Set equal Full trust.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.