Blog

 Matthew's Musings

DNN Module access to a web service and and System.Security.SecurityException: Request for the permission of type System.Net.WebPermission

Jul 19

Written by:
7/19/2006 10:48 AM  RssIcon

In attempting to call a web service in DNN I got an error.

"System.Security.SecurityException: Request for the permission of type System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
   at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken)
   at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride)
   at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& 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 ReferenceManagerInterop.ReferenceManagerProxy.SearchAndReturnIDs(String version, String searchExpression, Int16 databaseCount, String sortKey, Int64 maxRecords, String[] databaseArray, String[]& results_list)
   at ReferenceListing.Display()"

There were a few sources of information about this both in and out of DNN (e.g., Cathal Connlly's post,  this link, or this one). However, none of them seemed to eactly solve my problem. or seemed to fit what my configuration files looked like.

What finally worked was to edit the web_medium.config file adding "<URI uri="http://bibliography.mimh.edu/cgi-bin/RSSoapServer"/>" in the following section.


<IPermission class="WebPermission" version="1">
    <ConnectAccess>
        <URI uri="$OriginHost$"/>
        <URI uri="http://bibliography.mimh.edu/cgi-bin/RSSoapServer"/>
    </ConnectAccess>
</IPermission>
This gave me the needed access and stopped the errors.

One significant problem with this solution is that you need to have access to the web_mediumtrust.config file. If you have a way to do this without having this access please let me know.

As a side note I also had to add a webServices setting to the web.config file in the format of:

<system.web>
    <webServices>
      <soapExtensionTypes>
        <add type="ReferenceManagerInterop.SoapExtension.SoapClientExtensionInterceptor, ReferenceManagerInterop" priority="1" group="0" />
      </soapExtensionTypes>
    </webServices>
...
 </system.web>

   
     
       
     

   

    ...

Tags:
Categories:

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
There are no categories in this blog.