Home All Groups Group Topic Archive Search About

Runtime Security Policy Question

Author
19 Sep 2006 7:50 AM
SD
Hi,

I have an assembly (.exe) started at logon of each computer of my company
and for each user. (Through PDC scripts)

This assembly use web services in order to request any informations.

When my exe is executed, i have this exception :
_________________________________________________________________
Échec de la demande pour une autorisation de type System.Net.WebPermission,
Syst
em, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
mscorlib
   at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
granted
Set, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken
permT
oken)

   at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken,
CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames,
Int32
unrestrictedOverride)

   at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, S
tackCrawlMark& stackMark)

   at System.Security.CodeAccessPermission.Demand()

   at System.Net.HttpRequestCreator.Create(Uri Uri)

   at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)

   at System.Net.WebRequest.Create(Uri requestUri)

   at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)

   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri
uri)

   at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri
uri)

   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)

   at ManageWebFolders.Webs.Webs.GetAllSubWebCollection()

   at
ACFCIHexagone.ManageWebFolders.ManageWebFolders.GetWebCollection(String
sUrl, Hashtable ht)

   at ACFCIHexagone.ManageWebFolders.ManageWebFolders.Main(String[] args)
_________________________________________________________________
I understand it's a code access security pb but i don't know how to
configure my assembly to be authorized to run under my domain.

Need help please

Thanks

SD

Author
24 Sep 2006 3:08 AM
Joseph Bittman MVP MCSD
Sept. 23, 2006

....  It sounds like your code (exe) doesn't have permission to access the
web... This can be caused by if your exe is not located on the local hard
drive, but running from a network share or such. (by running from the local
HD, your code gets all permissions... unless it has been changed from the
default by the Administrator of the domain or such... in which case, you'd
have to ask your administrator for what he/she could do about getting more
permissions for your assembly)

I've got some blog entries about Code Access Security (CAS), which could be
quite helpful in examining your assembly's permissions, and understanding
the implications of where it is running from (and to examine which "zone"
you would need to run it under in order to have the correct permissions).

My CAS blog is here:
http://cactidevelopers.resdev.net/Product%20Guides/ProductBlog.aspx?GuideID=66dcc35e-340a-18b0-69c8-45ed4f806c7e

Specifically, after reading a little bit about how CAS works... I think this
entry might be most helpful in helping to understand the proper direction
you would need to take or research to get what you need done:

http://cactidevelopers.resdev.net/Product%20Guides/ProductGuideEntry.aspx?GuideID=66dcc35e-340a-18b0-69c8-45ed4f806c7e&EntryID=78e62cf5-5953-2bb2-ab80-8088a186a154

Hope this helps!
--

                       Joseph Bittman
     Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Blog/Web Site: http://CactiDevelopers.ResDev.Net/
Show quoteHide quote
"SD" <raspoutin***@hotmail.com> wrote in message
news:OKKwdB82GHA.836@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I have an assembly (.exe) started at logon of each computer of my company
> and for each user. (Through PDC scripts)
>
> This assembly use web services in order to request any informations.
>
> When my exe is executed, i have this exception :
> _________________________________________________________________
> Échec de la demande pour une autorisation de type
> System.Net.WebPermission,
> Syst
> em, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
> mscorlib
>   at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
> granted
> Set, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken
> permT
> oken)
>
>   at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
> permToken,
> CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames,
> Int32
> unrestrictedOverride)
>
>   at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
> cap, S
> tackCrawlMark& stackMark)
>
>   at System.Security.CodeAccessPermission.Demand()
>
>   at System.Net.HttpRequestCreator.Create(Uri Uri)
>
>   at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
>
>   at System.Net.WebRequest.Create(Uri requestUri)
>
>   at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri
> uri)
>
>   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri
> uri)
>
>   at
> System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri
> uri)
>
>   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
> methodName, Object[] parameters)
>
>   at ManageWebFolders.Webs.Webs.GetAllSubWebCollection()
>
>   at
> ACFCIHexagone.ManageWebFolders.ManageWebFolders.GetWebCollection(String
> sUrl, Hashtable ht)
>
>   at ACFCIHexagone.ManageWebFolders.ManageWebFolders.Main(String[] args)
> _________________________________________________________________
> I understand it's a code access security pb but i don't know how to
> configure my assembly to be authorized to run under my domain.
>
> Need help please
>
> Thanks
>
> SD
>
>