InfoPath 2k3

S

swatch

Hi,
My problem deals with Web Service & System.Net.WebPermission

I created an InfoPath Visual C# projet with Visual Studio 2k3 and added a
form (called toto).
When the form is load a Web Service is called to retreive data stored in a
DB (this is not the issue).

In design mode I can preview the form. The Web Service return the desired
informations.
Everything work fine.
Then I published the form on a shared directory
(\\SERVER\SHARE$\DIRECTORY\toto.xsn)

When I double click on \\SERVER\SHARE$\DIRECTORY\toto.xsn I obtain the
hereunder error

System.Security.SecurityException
Request for the permission of type 'System.Net.WebPermission, System,
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.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
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 ventesAuxPersonnels.WS_Workflow.WebServicesSGF.getUserId(String loginNT)
at ventesAuxPersonnels.ventesAuxPersonnels.initChamp()
at ventesAuxPersonnels.ventesAuxPersonnels.OnLoad(DocReturnEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)

Any ideas ?
 
S

swatch

Hi Clay
Thanks a lot for responding.

I found the solution monday :

1) I installed a Certification Authority in my organization.
1) I created a certificate that is suitable for digital signing
2) installation in the Personal Certificate Store of each user's computer.
3) I signed the form Tools | Form Options | Security
4) I deployed the form


This link help me
http://collabr8.blogspot.com/2005/09/how-to-code-sign-managed-code-infopath.html


S.Y.M. Wong-A-Ton said:
Try configuring code access security for your web service. For more
information, see http://msdn2.microsoft.com/en-us/library/aa302425.aspx
---
S.Y.M. Wong-A-Ton


swatch said:
Hi,
My problem deals with Web Service & System.Net.WebPermission

I created an InfoPath Visual C# projet with Visual Studio 2k3 and added a
form (called toto).
When the form is load a Web Service is called to retreive data stored in a
DB (this is not the issue).

In design mode I can preview the form. The Web Service return the desired
informations.
Everything work fine.
Then I published the form on a shared directory
(\\SERVER\SHARE$\DIRECTORY\toto.xsn)

When I double click on \\SERVER\SHARE$\DIRECTORY\toto.xsn I obtain the
hereunder error

System.Security.SecurityException
Request for the permission of type 'System.Net.WebPermission, System,
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.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
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 ventesAuxPersonnels.WS_Workflow.WebServicesSGF.getUserId(String loginNT)
at ventesAuxPersonnels.ventesAuxPersonnels.initChamp()
at ventesAuxPersonnels.ventesAuxPersonnels.OnLoad(DocReturnEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)

Any ideas ?
 

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

Top